Re: GD Image Resizing on the fly.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi

this the script i use in www.biere.org

you can see it in action at
http://www.monsieur-biere.com/liste/secondairelmc.php3?type=type&type2=BIERE+DE+NOEL&page=1
i use the same script in rhe shopping cart and in the order form

it test if the file exist and resize it at predefined size or peoduce a
single dot image transparent, it was easy to modify this script to your
needs


<? /* Header ("Content-type: image/png"); */
$imname="imagesb//".$ref.".png";
if (file_exists($imname)):
        $im = ImageCreatefrompng($imname);
        $rat=60.0*(doubleval(imagesx($im))/doubleval(imagesy($im)));
        $im2 = ImageCreate($rat, 60);

imagecopyresized($im2,$im,0,0,0,0,$rat,60,imagesx($im),imagesy($im));
else:
        $im2 = ImageCreate(1, 1);
        $green = ImageColorAllocate($im2, 0, 255, 0);
        imagefilledrectangle($im2,0,0,1,1,$green);
endif;
Imagepng($im2);
?>

denis

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux