Trying to get an image block to have a link to itself.

Permalink
Hi everyone,

Is there any way I could get an image block to link to itself?



I really like being able to use the file manager to select images but the only options I have for setting a link for the image is either to another page or an external URL.

I understand I could get the url from the file manager (example: "/index.php/download_file/view_inline/9/") but it would be awesome if there'd be an automated possibility. (I'm currently using a content or html block with manual href\src)



Any thoughts?



Kind regards,

Michael

Michaeldegreef
 
jelthure replied on at Permalink Best Answer Reply 1 Attachment
jelthure
Currently you would have to alter the block itself to accomplish this by extending the controller and a few other files. I've attached something that should work for you if you are not experienced with PHP.

Just drop the "image" folder in the attached zip file into the blocks folder at the root of your site, so:

/blocks/image


after you do that then you can add the image block to a page as normal, electing not to enter a link. Then after you hit "Save" on the block dialog and it inserts the image to the page, click the image again and select "Custom Templates". Then select "Image Linked To Itself" from the drop down. Save and done.

This links the directly to the file.

Happy C5'n!
Michaeldegreef replied on at Permalink Reply
Michaeldegreef
Hi Jelthure,

That worked great! Thanks for your help :)!