Note that there are some explanatory texts on larger screens.

plurals
  1. PODoes PHP or Apache Cache Downloaded Images?
    text
    copied!<p><strong>Problem</strong></p> <p>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. </p> <p>The issue is not browser caching as I am looking at the photo directly through windows explorer after copying via FTP.</p> <p><strong>Example</strong></p> <p>1:00pm: Download Photo URL A -> Downloads Photo A</p> <p>1:30pm: Photo A changed to Photo B, but photo URL remains the same</p> <p>2:00pm: Download Photo URL A Again -> Downloads Photo A (But Should be Photo B)</p> <p><strong>My download script</strong></p> <pre><code>function resampimagejpg( $forcedwidth, $forcedheight, $sourcefile, $destfile ) { $fw = $forcedwidth; $fh = $forcedheight; $is = getimagesize( $sourcefile ); if( $is[0] &gt;= $is[1] ) { $orientation = 0; } else { $orientation = 1; $fw = $forcedheight; $fh = $forcedwidth; } if ( $is[0] &gt; $fw || $is[1] &gt; $fh ) { if( ( $is[0] - $fw ) &gt;= ( $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; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload