Solved

# Rotate Image - Help Please!

Posted on 2002-07-03
234 Views
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);

?>

0
Question by:Nottingham
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 7
• 6

Author Comment

ID: 7126464
I need an answer ASAP. So I have increased the points
0

Author Comment

ID: 7126468
I need an answer ASAP. So I have increased the points
0

LVL 6

Expert Comment

ID: 7126579
Try to replace

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

with

\$ris_x=\$tot_y;
\$ris_y=\$i_x;
0

Author Comment

ID: 7126586
Nope didn't work - sorry!
0

LVL 6

Expert Comment

ID: 7126599
sorry, with

with

\$ris_x=\$i_y;
\$ris_y=\$i_x;
0

Author Comment

ID: 7126604
Nope didn't work - sorry!
0

Author Comment

ID: 7126607
ignore the last comment
0

LVL 6

Expert Comment

ID: 7126611
sorry, with

with

\$ris_x=\$i_y;
\$ris_y=\$i_x;
0

LVL 6

Expert Comment

ID: 7126614
sorry, I've post duplicate message as you :)
0

Author Comment

ID: 7126615
Almost there although it seems to rotate 90 then mirror that. Not rotate -90.

Points increased for trying!
0

LVL 6

Accepted Solution

andreif earned 500 total points
ID: 7126712
we are getting closer :)

\$ris_x=\$i_y;
\$ris_y=\$tot_x-(\$i_x+1);
0

Author Comment

ID: 7126833
Well Done!!!! It had me stuck!!

Thanks everso much!

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

LVL 6

Expert Comment

ID: 7126851
Thanks!
Could you close duplicate question?

http://www.experts-exchange.com/php/Q_20319032.html
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

splitting a sting into elements 6 70
MySQL Persistent Connections 10 54
How do I speed up this PDO query 4 39
htaccess add www, redirect to https, keep query string 17 54
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult toâ€¦
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creatâ€¦
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and â€¦
###### Suggested Courses
Course of the Month7 days, 1 hour left to enroll