Jump to content
MakeWebGames

BBCode [img] Resize


hobbes
 Share

Recommended Posts

Re: BBCode Resize

http://criminalexistence.com/ceforums/i ... ic=23871.0

That post demonstrates how to scale down an image to a predefined max size. You would get a x/y list of numbers that you can plug into the img tag as width="y" height="x".

If you just toss in width and height attributes that are the same on all images, then all images will be that size. This code above only scales down images larger than that max size, keeps proportions, and doesn't increase the size of smaller images.

Link to comment
Share on other sites

Re: BBCode Resize

You'd have to hack into the bbcode engine, and after the part where the bbcode engine isolates the contents of tags, you would feed that data into the script I linked to.

It would require some modification of both the bbcode engine and the script I linked to, but that script has a good solid foundation to build on.

Link to comment
Share on other sites

Re: BBCode Resize

browsers always make the image in the img tag fill the available space. adding width to that will cause the image to resize.

if you wrap the img tag in a div, and apply the width and overflow to the div, then the image in the img tag will be contrained like you're talking about. ;)

of course the portion of the image that doesn't fit the space is simply hidden from view. "overflow: auto" would add scroll bars

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...