Make an image into a link

I didn’t think that this would be a big deal but it was bigger than I thought. Now that I am able to display an image via a node from a custom content type without a bunch of fields normally associated with comments, titles, etc., I also want to be able to use that image as a link to an internal or external site.

LinkImage Defines an link image field type.

Requires: Field (enabled), Field SQL storage (enabled), Image (enabled), File (enabled)
Required by: Drupal (Field type(s) in use – seeĀ Field list)

This is what I needed. this allows a Link IMage Field Type to be added to your content type for handling images. So by using this module, along with the Exclude Node Title, I can now place any image in a panel and have that image act as a link. Very nice!

Here is a ss of the Custom Content Type that I created for Images. I could then go into the node itself and add a url to the image. I actually had to play with it a bit but it will work. I had to delete the original node and readd after adding the field to the content type.

DOCResource.org

Advertisements

Adding Images to a Panel

Drupal does a lot of things really well. and some not so. and image display is one of the ones that i really don’t care for. But, i have a couple of hints for simple image display in a panel. This is what I wanted. The logo with the site name is at the top left now without any added stuff. That’s all I wanted was the image. and getting that was harder than i expected. This is what I did:

Image

  • Created a custom content type for images
  • Installed the module Exclude Node Title. this allowed me to display the node without having its title above and to the left. Very annoying. all i want is the image
  • Added content of the type that I created for the image that has an image field. I checked the box for “exclude title…”, which is an option you get after you install the module I mentioned above.
  • I went to the panel page that I want to add the image to. I click “add content” to the first sidebar and then choose Existing Node

existing node

 

adding the image node to panel

I then type the name of the image node that I created before. Autofill will help you with this.

At the Configure Existing Node (as seen below) I had to tweak it a bit to allow the new module to do its job. Somewhat counter-intuitively, you have to check the over ride title here and leave it blank so that the exclude mod can over ride it. That seems a little redundant but it worked for me.

The end result is a nice Panel piece that simply displays an image and nothing else. Because the content type that I created specifies an Image, I can also add alt text and hover info from the content itself. At some point, I’ll also want to make this image link back to a URL the same way it does if it is specified at the theme level.

 

 

Colorbox

I’m installing the Colorbox Module in Sand today and will then install in Prod. I don’t have a compelling reason to install it now; my site doesn’t focus on images. But I believe that there will be media that I’ll want to show. It’s a web site after all. And at some point I’ll need to be able to do this.

There are MANY gallery options in Drupal. My needs are pretty simple so I don’t feel the need to get anything too fancy.

This mod has been around for a long time and has 100ks of installs. So it is nice and stable and well maintained. It requires a jscript library that you can download.

http://www.jacklmoore.com/colorbox – reference for colorbox.

Learn GIMP

i have a confession. i have a really bad habit. i use mspaint. a lot. i have used it for about 20 years and it has made me insufferably lazy because when it comes down to it, it sucks. you can’t do much with it at all. so, i am learning GIMP as a part of this ongoing learning process. unless you have the money for photoshop, get a copy of free GIMP and start learning. being a competent drupal developer means being able to do at least some image manipulation. so learn GIMP and do yourself a favor.