Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8568173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:03:06+00:00 2026-06-11T18:03:06+00:00

I am trying to put a rotate img function on my site. I am

  • 0

I am trying to put a rotate img function on my site. I am using imagejpeg() but it returns a sloo full of gibberish. Can you explain why?

                if ($_GET["rotate"] == "clockwise")
                {

                    $degrees = 90;

                    // Content type
                    //header('Content-type: image/jpeg');

                    // Load
                    $source = imagecreatefromjpeg($path);

                    // Rotate
                    $rotate = imagerotate($source, $degrees, 0);

                    // Output

                    if (imagejpeg($rotate))
                    echo "Your image has been rotated clockwise";
                } 
                if ($_GET["rotate"] == "counterclockwise")
                {
                    $degrees = 270;

                    // Content type
                    //header('Content-type: image/jpeg');

                    // Load
                    $source = imagecreatefromjpeg($path);

                    // Rotate
                    $rotate = imagerotate($source, $degrees, 0);

                    // Output
                    if (imagejpeg($rotate))
                    echo "Your image has been rotated Counterclockwise";
                }
                ?>

It pastes this onto the page:

ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC $.’ “,#(7),01444’9=82<.342ÿÛC 2!!22222222222222222222222222222222222222222222222222ÿÀûÛ”ÿÄ ÿĵ}!1AQa”q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq”2B‘¡±Á #3RðbrÑ $4á (AND ON AND ON FOR A LONG WAY)

If I change it to clockwise the gibberish changes as well, so I think it’s working somewhat, but it’s not creating a jpg from it. Any help would be awesome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:03:07+00:00Added an answer on June 11, 2026 at 6:03 pm

    That is the image. You’re just not telling your browser that it is, your browser interprets the data as text. Set a header to tell your browser to interpret the data as image:

    header('Content-Type: image/jpeg');
    

    The image data will have to be the only thing output on the page, no other HTML or text before or after it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to put a function call that returns an int into a call for
Trying to put a regex expression together that returns the string between _ and
I'm trying to put together a layout using Bootstrap that resembles your typical OS
Trying to put in field pagar the calculated value of precio * 15% but
I am trying to put an indeterminate ProgressBar on the actionBar. I was using
I'm trying to put together an iPad app using UISplitViewController and storyboards. The master
iam trying to put the div menu above the object tag but still under
I'm trying to put the content of a file into a variable, but I'm
I'm trying to put admob ad at the top of my app but the
We're trying to put together kiosk solution where we can charge people by hour

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.