note 71822 added to function.imagecreatefromjpeg

From: Date: Mon, 18 Dec 2006 08:38:42 +0000
Subject: note 71822 added to function.imagecreatefromjpeg
Groups: php.notes 
Request: Send a blank email to php-notes+get-120717@lists.php.net to get a copy of this message
Going along with the example on the top of the page I added a simple rand() script in to randomly change and save the image here's what I have: <?php $rand = rand(1,3); if($rand == 1) { $imgname = "1.jpg"; } else if ($rand == 2) { $imgname = "2.jpg"; } else { $imgname = "3.jpg"; } $im = @imagecreatefromjpeg($imgname); /* Attempt to open */ if (!$im) { /* See if it failed */ $im = imagecreatetruecolor(150, 30); /* Create a black image */ $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); /* Output an errmsg */ imagestring($im, 1, 5, 5, "Error loading $imgname", $tc); } ImageJPEG($im,"4.jpg"); ?> You can see that it creates 4.jpg every time the script is run. After I did that I set a cron job on my server to run that php script every minute so I can have the image constantly changing. An example of this can be found here: www.pwddnet.net/randomsig/another.php And the Image Created can be found here: www.pwddnet.net/randomsig/4.jpg Any questions or comments send to peterolds@peterolds.info ---- Server IP: 216.194.113.175 Probable Submitter: 67.172.249.201 ---- Manual Page -- http://www.php.net/manual/en/function.imagecreatefromjpeg.php Edit -- https://master.php.net/note/edit/71822 Del: integrated -- https://master.php.net/note/delete/71822/integrated Del: useless -- https://master.php.net/note/delete/71822/useless Del: bad code -- https://master.php.net/note/delete/71822/bad+code Del: spam -- https://master.php.net/note/delete/71822/spam Del: non-english -- https://master.php.net/note/delete/71822/non-english Del: in docs -- https://master.php.net/note/delete/71822/in+docs Del: other reasons-- https://master.php.net/note/delete/71822 Reject -- https://master.php.net/note/reject/71822 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120717) next »