Jump to the post that solved this thread.
Solved: 7 Years ago wrap img with a div ?
#1
Solved: 7 Years ago
hi

i want to add a little bit security to my forum images so i want to wrap the [img] with a div to make it something like that :

<div style="height: auto; overflow: hidden;">
  <img src="[img]" alt="your image" />
</div>

is it possible ?

thanks
Reply
#2
Solved: 7 Years ago
I don't understand why you want do this but here is a way how:

Add a new custom MyCode in ACP > Configuration:
MyCode: Image Wrote:Title: IMG Tag

Short Description: Style IMG Tag

Regular Expression:

\[img\](.*?)\[/img\]

Replacement:

<div style="height: auto; overflow: hidden;"><img src="$1" alt="your image" /></div>
Reply
#3
Solved: 7 Years ago
thanks , but my code is not working i want to prevent my forum images from saving
Reply
#4
Solved: 7 Years ago
^ we can't prevent copying / saving images.
Reply
#5
Solved: 7 Years ago
i know but at least make it harder to copy
Reply
#6
Solved: 7 Years ago
If you want it to be really tricky, you could have the image url be the background-image property of a div.

Ex.
Regex: \[img\](.*)\.(png|jpg|bmp|gif)\[\/img\]
Replacement: <div style="background-image: url($1$2)"><img src="$1$2" alt="image" style="visibility:hidden" /></div>

Visbility:hidden is used so it tricks the div into figuring out how much space to allot. You may need quotes around $1 and $2 in the parenthesis.
Reply
#7
Solved: 7 Years ago
(2015-01-22, 03:39 PM)dragonexpert Wrote: If you want it to be really tricky, you could have the image url be the background-image property of a div.

Ex.

Regex: \[img\](.*)\.(png|jpg|bmp|gif)\[\/img\]
Replacement: <div style="background-image: url($1$2)"><img src="$1$2" alt="image" style="visibility:hidden" /></div>

Visbility:hidden is used so it tricks the div into figuring out how much space to allot.  You may need quotes around $1 and $2 in the parenthesis.


wow your so smart i tried one day to figure out how to size the div to match the pic bu t i couldnt thanks mate !!

oops another error came i edited your code a little bit and know it doubles the image

Regular EXP: \[img\](.*?)\[/img\]
Replacement:
<div style="background-image: url($1)"><img src="$1" alt="وێنە" style="visibility:hidden" /></div>
Reply
#8
Solved: 7 Years ago
Try this:

Regular EXP:
\[img\](.*?)\[\/img\]

Replacement:
<div style="background: url($1) no-repeat;display:inline-block;"><img src="$1" alt="وێنە" style="visibility:hidden" /></div>
Reply
#9
Solved: 7 Years ago
Thank you guys you all helped me alot Smile thank you SvePu +1 and dragonexpert +1
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)