#22756 [Com]: ImageJPEG
| From: | freish at 55it dot com | Date: | Thu, 20 Mar 2003 02:18:00 +0000 |
| Subject: | #22756 [Com]: ImageJPEG | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-36005@lists.php.net to get a copy of this message | ||
ID: 22756
Comment by: freish at 55it dot com
Reported By: boy at 7935 dot com
Status: Feedback
Bug Type: GD related
Operating System: WIN2000
PHP Version: 4.3.1
New Comment:
thank you, I solved this problem with imagecreatetruecolor() with your
help. I need take more time to read the manuals before I submit a bug
report, I think.
Previous Comments:
------------------------------------------------------------------------
[2003-03-19 11:52:25] pollita@php.net
The demonstration link you provided does not work (Indeed I get not so
much as a ping response from that host). Judging from your script my
guess is that it's a palette issue which can be solved by using
imagecreatetruecolor() rather than imagecreate().
------------------------------------------------------------------------
[2003-03-17 21:42:48] boy at 7935 dot com
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 this bug report at http://bugs.php.net/?id=22756&edit=1