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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:56:14+00:00 2026-05-19T01:56:14+00:00

What headers should a send with an image output (image.php when opened allows user

  • 0

What headers should a send with an image output (image.php when opened allows user to download an image) to set caching time for that image to 3 days (instead of re-downloading the image from the user side) ??

and how can i compress the image and send it compressed and what headers should i send along to tell the browser that this image is compressed ?

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-05-19T01:56:14+00:00Added an answer on May 19, 2026 at 1:56 am

    Well, the easiest way to compress is to enabled deflate or gzip from the htaccess level if you’re running apache. If not, you can add the ob_gzhandler() function as the ob_start() callback at the beginning of the document like so:

    <?php
    if( !ob_start("ob_gzhandler") ) {
        ob_start();
    }
    //Feel free to echo image data and whatnot, the callback deals with the headers, compatibility, and compression!
    ?>
    

    Note this requires the zlib extension.

    You can also add this function as the ob callback in the php.ini file or enable the zlib.output_compression directive.

    As for setting up caching, simply add this header() call before outputting text:

    <?php
    header('Cache-Control: max-age='.(5184000 * 3).', must-revalidate'); //Cache should last for 3 days
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have headers in <h1> through <h6> tags. Is there a way that I
I am using a library that has headers without the .h This defeats visual
I have many many small images that are displayed on a user's profile and
I am hooking firefox's send and WSARecv. Send should remove the gzip header (=>
I send back an image with the following HTTP response header: Cache-Control: private,max-age=86400 My
I am using MAMP (LAMP stack development environment) to send emails using PHP. The
I just want to download an image. Then upload it to Amazon S3. But
When I send a 304 response. How will the browser interpret other headers which
I found on Google some PHP scripts to limit the download speed of a
Assume browser default settings, and content is sent without expires headers. user visits website,

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.