Link to home
Start Free TrialLog in
Avatar of Nottingham
Nottingham

asked on

Rotate Image - Help Please!

This works great! But I need it to do a -90 degree as well.


<?

$img_sorgente="ruotami.jpg";

$size = GetImageSize($img_sorgente);
$tot_x = $size[0];
$tot_y = $size[1];

$img_risulta = ImageCreate ($tot_y,$tot_x)

$img_sorgente=ImageCreateFromJpeg($img_sorgente);

for($i_x=0;$i_x<$tot_x;$i_x++){

        for($i_y=0;$i_y<$tot_y;$i_y++){      

        $ris_x=$tot_y-($i_y+1);
        $ris_y=$i_x;
       
        imagecopy($img_risulta, $img_sorgente,
$ris_x,$ris_y,$i_x,$i_y,1,1);
       

        } // Y

} // X

Imagejpeg($img_risulta);

?>


Avatar of Nottingham
Nottingham

ASKER

I need an answer ASAP. So I have increased the points
I need an answer ASAP. So I have increased the points
Try to replace

$ris_x=$tot_y-($i_y+1);
$ris_y=$i_x;

with

$ris_x=$tot_y;
$ris_y=$i_x;
Nope didn't work - sorry!
sorry, with

with

$ris_x=$i_y;
$ris_y=$i_x;
Nope didn't work - sorry!
ignore the last comment
sorry, with

with

$ris_x=$i_y;
$ris_y=$i_x;
sorry, I've post duplicate message as you :)
Almost there although it seems to rotate 90 then mirror that. Not rotate -90.

Points increased for trying!
ASKER CERTIFIED SOLUTION
Avatar of andreif
andreif
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well Done!!!! It had me stuck!!

Thanks everso much!

I really appreciate that - you saved me hours!!!