
July 22nd, 2003, 06:44 PM
|
|
Junior Member
|
|
Join Date: Jun 2003
Location: East Lansing, MI
Posts: 7
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
GD Problems
I'm trying to create a scrip that will rotate pictures. The only time this works is when i rotate the first time to the right. Other then that it gets totally altered. here is the code, anyone have any ideas?
Thanks in advance!
PHP Code:
$define = explode(",", $action);
if ($define[0]=="rotate") {
if ($define[1]=="right") {
$angle = -90;
} else if ($define[1]=="left") {
$angle = 90;
}
$src_img = ImageCreateFromJPEG($path . $current["id"] . "_" . $current["title"] . "/temp/" . $define[2]);
$original_x = imagesx($src_img);
$original_y = imagesy($src_img);
$new_x = $original_y;
$new_y = $original_x;
$src_img = ImageRotate($src_img,$angle,0);
$dst_img = imagecreatetruecolor($new_y,$new_x);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $new_x, $new_y, $original_x, $original_y);
imagejpeg($src_img, $path . $current["id"] . "_" . $current["title"] . "/temp/" . $define[2]);
Header("Location: $PHP_SELF?start=$start");
}
|