Graphic as hyperlink

Graphic as hyperlink

by Mark Granger -
Number of replies: 4

Does anyone have a solution to this or can point me as to what might be wrong.

I'm simply trying to use a graphic as a hyperlink to a website.

Ive tried:

  • Inserting graphic and then using the insert weblink tool - just comes back with a blank picture holder.
  • Typing some text, selecting it and adding weblink to it, then immediately inserting a graphic over the top of it. This sometimes works / sometimes doesn't. It seems to work if the insert weblink at the text stage returns with the text still highlighted.

I would be grateful for a steer on this as a number of our Infant schools are understandably losing heart as they are trying to make their Moodle courses more graphically orientated for their youngsters.

Many thanks.
PS I did a search in the forum and googled the problem but didnt find anything. Is this a unique problem to us?

Average of ratings: -
In reply to Mark Granger

Re: Graphic as hyperlink

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Mark,

When you say "graphic" I suppose you mean an image (JEPG, GIF, etc.) file?

In the Moodle HTML editor it is not possible to directly insert a Web link on an image as you would do by selecting text. Here is a workaround showing how you can insert a link to Moodle.org on an image of a Moodle logo.

  1. In the HTML editor, type e.g. the word moodle, select it, click on the Insert Web Link button, type http://moodle.org.
  2. Now, immediately after the Web link you created on the word moodle, insert an image of the Moodle logo. Click on the Insert Image button in the toolbar and use an image of the Moodle logo that you previously uploaded to your Moodle course files.
  3. Switch to HTML Code (Toggle HTML source button in the toolbar).
  4. Locate the word moodle with its hypertext link and delete it (just delete the word moodle, not the whole <a href="http://moodle.org"></a> tag!
    <a href="http://moodle.org">moodle</a>
  5. Locate the image tag, something like <img title="moodle" alt="moodle" src="http://.../moodle/file.php/6/images/moodle.jpg" border="0" height="20" hspace="0" vspace="0" width="89" /> and check that is is located within the the <a></a> tag. If not, move it (move it (drag and drop it) there. You must see this: <a href="http://moodle.org"><img width="89" vspace="0" hspace="0" height="30" border="0" src="http://.../moodle/file.php/6/moodle.jpg" alt="moodle" title="moodle" /></a>

On the attached screen shot you can see that when the mouse is hovering over the moodle logo image, a link to moodle.org is visible in the status bar, meaning that the web link has been correctly attached to that image.

QED

Joseph

Of course things would be easier if it were possible to automatically insert a web link on an image in the HTML WYSIWYG editor mode!
Attachment image00.jpg
In reply to Joseph Rézeau

Re: Graphic as hyperlink

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
This bug used to exist, but I think it got fixed eventually. Yep: MDL-7043
In reply to Tim Hunt

Re: Graphic as hyperlink

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
You're right, Tim! It works OK at least in Moodle 1.8. Should have tested it before producing this lengthy, useless workaround.blush
Joseph
In reply to Mark Granger

Re: Graphic as hyperlink

by Bil Owen -
Isn't there a way to insert a hyperlink into a photoshoped image? I stumbled across it once I am sure. I haven't tried it yet (still learning PS) but that is the way I am going try for creating nice looking topic/week boxes.