Forum Moderators: coopster

Message Too Old, No Replies

Resizing problems with GD

         

Gero_Master

6:34 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



Hello!

I wonder what is wrong with my script. This seems to do just fine with the PNG and some GIF (ones it doesnt have to resize).

But if it has to resize gifs, they turn all black. And it will just give no error, but a red cross when it has to resize or even represent same size jpeg's.

How should I change it to make it usable with all the formats: gif, jpg, jpeg, png, bmp?

This is the part that is the trouble causer:

if($x_checked == false) {
$phase1 = imagecreate($new_x,$new_y);
imagecopyresized($phase1,$image,0,0,0,0,$new_x,$new_y,$rx,$ry);
} else {
$phase1 = imagecreate($new_x,$new_y);
imagecopyresized($phase1,$image,0,0,0,0,$new_x_2,$new_y_2,$new_x,$new_y);
}

henry0

11:53 am on Oct 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It very certainly is related to your GD version
Check HERE [us3.php.net]

Gero_Master

12:32 pm on Oct 21, 2006 (gmt 0)

10+ Year Member



I use XAMPP with GD2 which is the newest version i guess...

dreamcatcher

2:34 pm on Oct 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried using the following functions:

imagecreatefromjpeg [uk2.php.net]
imagecreatefrompng [uk2.php.net]
imagecreatefromgif [uk2.php.net]

dc