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 8265335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:45:50+00:00 2026-06-08T04:45:50+00:00

I am trying to use header(‘Content-type: image/jpeg’) to edit and display jpeg photos as

  • 0

I am trying to use header(‘Content-type: image/jpeg’) to edit and display jpeg photos as follows.

header('Content-type: image/jpeg') 
$filename = 'aaa.jpg';
 $im = imagecreatefromjpeg($filename); 
imagefilter($im, IMG_FILTER_CONTRAST,50);
imagejpeg($im);
imagedestroy($im); 

In the same file,I also have other simple codes like $abc = $_POST[‘abc’].
After I put the header, code before the header and code after image destroy($im) no longer work. And when I put any code such as $_post[‘abc’] before the header, both header and code doesn’t work. All codes were fine before I included header and code to manipulate and output image. It is my first time using header(‘Content-type: image/jpeg’) and I cannot find the answer after trying for so long. Please help. Thank you.

  • 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-08T04:45:52+00:00Added an answer on June 8, 2026 at 4:45 am

    If you want to output html page, do not send image header. But instead, at first output the transformed image to a file on your server and add the <img> or <a>nchor tag in your html page:

    <html><body>
    <?php
    $output_dir = 'images';
    if (!file_exists($output_dir)) {
        mkdir($output_dir, 0777);
    }
    $filename = 'aaa.jpg';
    $filename2 = 'aaa2.jpg';
    if (!file_exists($filename)) {
        echo 'Input image not exists!'; exit;
    }
    $im = imagecreatefromjpeg($filename);
    imagefilter($im, IMG_FILTER_CONTRAST, 50);
    imagejpeg($im, $output_dir.'/'.$filename2);
    imagedestroy($im);
    
    echo 'Original image:<br/><img src="'.$filename.'" /><br/>';
    echo 'Transformed image:<br/><img src="'.$output_dir.'/'.$filename2.'" />';
    ?>
    </body></html>
    

    That image header send in case, you want to output it as standalone image. For more examples have a look at php.net.

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

Sidebar

Related Questions

I am trying to use a RequestHeader edit directive to take the Cookie header,
I am trying to use an image as a header/title for a blog post
I am trying to use header file sstream.h Below is my code segment #include
I'm trying to use the header() function to create a redirect. I would like
trying to use this route: from(activemq:profiles).aggregate(header(cheese)).batchSize(30).bean(ProfilesQueueService, saveContacts) Fails with: No signature of method: org.apache.camel.model.RouteType.aggregate()
I'm trying to use is_member_pointer from the type_traits header, with the following syntax, for
I was trying to use this code: if($_SERVER['HTTP_PORT'] !== 443 && !isset($_SERVER['HTTPS'])) { header('Location:
I'm trying to use standard system header files in my C++ XCode project: #include
I am trying to use the 960 grid system with header and footer graphics
I'm trying to use Regex to get a bit if HTTP header parsing done.

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.