Click to See Complete Forum and Search --> : Show image in 40% of her size


svenicsale
06-14-2003, 12:56 PM
I am trying to make a script that will look up a folder for pictures and then randomlly display image daily or change after a few minutes.... But it needs to show the picture in 30 or 40% of her size, so it would look like a thumbnail... Anyone know how to do all this stuff?

pyro
06-15-2003, 05:52 PM
You can get the size of an image like this:

<?PHP

$pic = "your.gif";

$wh = getimagesize($pic);
$width = $wh[0];
$height = $wh[1];

echo $imagewidth."x".$imgheight;

?>From there, it is just simple math to get 30 or 40%. But, you would be better off using the GD library to create thumbnails as it would save you some download time... This link might help you: http://us2.php.net/manual/en/function.imagecreate.php

InternetAdSales
06-16-2003, 11:26 AM
Hi svenicsale,

You might want to save yourself some trouble reinventing the wheel and try one of the open source php applications out there such as 4images Gallery (http://www.4homepages.de/4images/demo.php). It's free for non-commercial use.

Cheers,

Bela