From: boy at 7935 dot com Operating system: WIN2000 PHP version: 4.3.1 PHP Bug Type: GD related Bug description: ImageJPEG
I write a script to genreate rand string and image it with imagejpeg, the picture(0.jpg-9.jpg)'s color is red and the picture(a.jpg-f.jpg)'s color is blue, but when I test it I found sometime the color of new image will make some mistake, such as red digital picture became white-blue and the blue digital picture became white-red. Setting: Apache2.0.44+PHP4.3.1 you can see the demo at http://www.blists.com/image.html please refresh it some times. thank you! <?php session_start(); $DIR_SET['vcode'] = "http://www.blists.com/images/vcode"; function Vcode($num = "",$type = "") { $string = array( 'digit'=>'0123456789', 'alpha'=>'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'mixed'=>'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'shortmixed'=>'01234567ABCDEF' ); $str = ""; if ($num == "") $num = 4; if ($type == "") $type = "mixed"; for ($i=0;$i<$num;$i++) { $offset = rand(0,strlen($string[$type])-1); $str .= @substr($string[$type],$offset,1); } return $str; } $str = Vcode(5,"shortmixed"); $_SESSION['vcode'] = md5($str); header("Content-Type:image/jpeg"); $src_im = imagecreate(100,18); $x = 0; for ($i=0;$i<strlen($str);$i++) { $image = substr($str,$i,1); $dst_im = imagecreatefromjpeg($DIR_SET['vcode']."/".$image.".jpg"); imagecopymerge($src_im,$dst_im,$x,0,0,0,20,18,100); $x+=20; } imagejpeg($src_im); ?> -- Edit bug report at http://bugs.php.net/?id=22756&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22756&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22756&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22756&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22756&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22756&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22756&r=support Expected behavior: http://bugs.php.net/fix.php?id=22756&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22756&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22756&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22756&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22756&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22756&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22756&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22756&r=gnused