note 100642 deleted from function.imagecreatefromjpeg by danbrown
| From: | danbrown@php.net | Date: | Wed, 27 Oct 2010 22:10:53 +0000 |
| Subject: | note 100642 deleted from function.imagecreatefromjpeg by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173532@lists.php.net to get a copy of this message | ||
Note Submitter: contacto at flor360 dot com
----
This is a script we use at http://flor360.com to randomly create a
3 image composite to advertise our site.
<?php
$output = 'flor360.com.random.jpg';
$c = 'SELECT photo_path FROM flor360_products ORDER BY RAND() LIMIT 3';
$r = db_query($c);
$canvas = imagecreatetruecolor(336,168);
$x = 0;
while($f = mysql_fetch_assoc($r))
{
$foto = imagecreatefromjpeg('IMG/i/'.$f['photo_path']);
imagecopyresampled($canvas, $foto, $x, 0, 0, 0, 112, 168, imagesx($foto), imagesy($foto));
imagedestroy($foto);
$x += 112;
}
$logo = imagecreatefrompng("estatico/logo_fuzzy.png");
imagecopy($canvas,$logo,0,0,0,0,336,168);
imagejpeg($canvas,$archivo,65);
imagedestroy($canvas);
?>
That composites the 3 image display and a overlay logo.
It also resample input images to 112x168.
It's great for forums signatures and more!, the best thing it's dynamic so people does not
get bored at seeing the same thing over and over again.
Put that script with a 'cron' call every 15 minutes and you're done!.
I make it wrote the output to a file so normal web-browser caching is possible. Then just a normal
URL to get it:
http://flor360.com/estatico/imagen_sms.todosv.com.jpg