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

  • Home
  • SEARCH
  • 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 8594003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:06:39+00:00 2026-06-12T00:06:39+00:00

Problem Using PHP to download a remote image using the same URL before and

  • 0

Problem

Using PHP to download a remote image using the same URL before and after the image is changed, downloads the same photo, even though the source is different. Somewhere the image is being cached.

The issue is not browser caching as I am looking at the photo directly through windows explorer after copying via FTP.

Example

1:00pm: Download Photo URL A -> Downloads Photo A

1:30pm: Photo A changed to Photo B, but photo URL remains the same

2:00pm: Download Photo URL A Again -> Downloads Photo A (But Should be Photo B)

My download script

function resampimagejpg( $forcedwidth, $forcedheight, $sourcefile, $destfile )
{

$fw = $forcedwidth;
$fh = $forcedheight;
$is = getimagesize( $sourcefile );
if( $is[0] >= $is[1] )
{
    $orientation = 0;
}
else
{
    $orientation = 1;
    $fw = $forcedheight;
    $fh = $forcedwidth;
}
if ( $is[0] > $fw || $is[1] > $fh )
{
    if( ( $is[0] - $fw ) >= ( $is[1] - $fh ) )
    {
        $iw = $fw;
        $ih = ( $fw / $is[0] ) * $is[1];
    }
    else
    {
        $ih = $fh;
        $iw = ( $ih / $is[1] ) * $is[0];
    }
    $t = 1;
}
else
{
    $iw = $is[0];
    $ih = $is[1];
    $t = 2;
}
if ( $t == 1 )
{
    $img_src = imagecreatefromjpeg( $sourcefile );
    $img_dst = imagecreatetruecolor( $iw, $ih );
    imagecopyresampled( $img_dst, $img_src, 0, 0, 0, 0, $iw, $ih, $is[0], $is[1] );
    if( !imagejpeg( $img_dst, $destfile, 95 ) )
    {
        exit( );
    }
    return true;
}
else if ( $t == 2 )
{
    copy( $sourcefile, $destfile );
    return true;
}
}
  • 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-12T00:06:40+00:00Added an answer on June 12, 2026 at 12:06 am

    Apache can cache images, that depends on the setup. The same applies to the browser.

    The easiest way to bypass caching for a certain asset, is to add a (reasonably…) unique query string at the end, for example a timestamp:

    // load image always, assuming output to html
    <img src="/path/to/image.jpg?<?php echo time(); ?>">
    

    Note that time() is not exactly unique, it effectively limits caching to 1 second…

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

Sidebar

Related Questions

I have a php script, which downloads, rescales and stores an image using the
i have a problem using some php functions on a string i get from
I've been using PHP for about 4 years, however I've come across a problem
I have a problem when trying to count in PHP using a button and
I have some problem to get the utf-8 string from PHP using jQuery $.load()
I'm having a problem right now with a function we're using in PHP to
Problem: I'm streaming my video from a php file with stream_get_contents(); using Flowplayer as
I am using gettext in my PHP code, but I have a big problem.
I'm posting data using jquery/ajax and PHP at the backend. Problem being, when I
I am using swiftmailer , a library for sending mail in php. The problem

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.