note 100642 added to function.imagecreatefromjpeg

From: Date: Wed, 27 Oct 2010 22:01:02 +0000
Subject: note 100642 added to function.imagecreatefromjpeg
Groups: php.notes 
Request: Send a blank email to php-notes+get-173530@lists.php.net to get a copy of this message
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 ---- Server IP: 69.147.83.197 Probable Submitter: 190.86.130.158 ---- Manual Page -- http://www.php.net/manual/en/function.imagecreatefromjpeg.php Edit -- https://master.php.net/note/edit/100642 Del: integrated -- https://master.php.net/note/delete/100642/integrated Del: useless -- https://master.php.net/note/delete/100642/useless Del: bad code -- https://master.php.net/note/delete/100642/bad+code Del: spam -- https://master.php.net/note/delete/100642/spam Del: non-english -- https://master.php.net/note/delete/100642/non-english Del: in docs -- https://master.php.net/note/delete/100642/in+docs Del: other reasons-- https://master.php.net/note/delete/100642 Reject -- https://master.php.net/note/reject/100642 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#173530) next »