Image block -> open in new window

Permalink 1 user found helpful
Is it possible to add an external url target (_blank) to an image with the image block? Or should I use a html block?

View Replies:
Ekko replied on at Permalink Reply 1 Attachment
Ekko
Use the content block, and add image. Than click on the image, and press the link button. Add your external url, and set target open in new window. To resize the image just adjust the transform box that appears when it is clicked. Screengrab atached just in case.
eddiethefarmer replied on at Permalink Reply
Thanks Ekko! I'm creating my first site with concrete5, I like it a lot.
nickratering replied on at Permalink Reply
nickratering
I'd like to use the image block for this, because TinyMCE wraps a paragraph around the image.

I've copied the class from the core to my root and changed the almost last line:
$img = "<a href=\"{$linkURL}\" target=\"_blank\">" . $img ."</a>";


But how can I make something like
if($linkURL == external){ echo ' target="_blank"'; }

?
keeasti replied on at Permalink Reply
keeasti
Did you know you can stop TinyMCE from doing that in its config file? NB. it would apply to all content blocks.

I am also looking for a way to do it with the image block ... did you figure it out? I'll post here if I find a solution.
keeasti replied on at Permalink Reply
keeasti
I found a solution by creating a new, modified Image block ... let me know if you are still looking to resolve this.
nickratering replied on at Permalink Reply
nickratering
I'd love to! ;-)
keeasti replied on at Permalink Reply 1 Attachment
keeasti
OK - just bear in mind that this quick and dirty solution I made does not have a nice dropdown menu to choose from or anything like that ... just adds target="_blank" to the <a> tag. I will make a more elegant solution when I get a little time but it does work :)

I attach the modified block ... do you know how to add it to Block types?


EDIT
Better solutions below
keeasti replied on at Permalink Reply
keeasti
And did you want to know how to stop the added <p></p> in TinyMCE?
keeasti replied on at Permalink Reply
keeasti
I just had a look the Add-ons section (should have done this first!) and there is a free add-on called Image Blank Target which does exactly what is needed:

http://www.concrete5.org/marketplace/addons/image-blank-target/...

It is a much more elegant solution :)
mhawke replied on at Permalink Reply
mhawke
keeasti replied on at Permalink Reply
keeasti
Hmmm ... that first one looks tasty - thanks!
nickratering replied on at Permalink Reply
nickratering
Thanks for replying!
hgstudio replied on at Permalink Reply
hgstudio
This really should be integrated into the core!
keeasti replied on at Permalink Reply
keeasti
For sure
cainKuri replied on at Permalink Reply
cainKuri
Thanks to your message i found the solution !

Thank you ! Just what i needed !