Jump to content


Photo

Resizing Images & Stuff


  • Please log in to reply
3 replies to this topic

#1 yarub

yarub
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts
  • LocationSioux City, IA

Posted 11 June 2006 - 03:23 AM

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?

<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' />
Does not work. >_<;

#2 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 11 June 2006 - 08:28 AM

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--]

#3 yarub

yarub
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts
  • LocationSioux City, IA

Posted 11 June 2006 - 07:55 PM

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?

#4 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 12 June 2006 - 05:01 PM

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

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

?> 

NoGray.com





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users