Jump to content

Archived

This topic is now archived and is closed to further replies.

yarub

Resizing Images & Stuff

Recommended Posts

Bah... it's still not working.

I'm looking for a way to make it so a link to a picture is auto-resized if it's wider than 175 pixels. At the same time, if it's smaller than 175 pixels, it will not resize at all.

Can anyone help?

[code]<img src='$row[profileimage]' onload='if(largerThan(this.width,175)) {this.width=175;this.alt=Click for a large version.;}' onmouseover='if(this.alt) this.style.cursor='pointer' onclick='if(this.alt) window.open('$row[profileimage]')' border='0' />[/code]Does not work. >_<;

Share this post


Link to post
Share on other sites
You have posted this in the wrong section. This has nothing to do with PHP! Mods, please move to the Javascript Forum.

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

Share this post


Link to post
Share on other sites
Well, whether or not it involves php or javascript, I still need help. It's got a little bit of both in it so I wasn't sure where to throw it. In any case, how can I fix it?

Share this post


Link to post
Share on other sites
You can use PHP to get the image size and print out the correct size.
[code]
<?php
list($width, $height, $type, $attr) = getimagesize("img/flag.jpg");
if ($width > 175) $width=175;

echo "<img src=\"img/flag.jpg\" width=\"$width\" />";

?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.