Skip to content

Instantly share code, notes, and snippets.

@zaigham
Last active December 11, 2015 14:18
Show Gist options
  • Save zaigham/4612852 to your computer and use it in GitHub Desktop.
Save zaigham/4612852 to your computer and use it in GitHub Desktop.
Hack to stop Chrome from downloading phpthumb images on every transition in slider
<?php
// AROUND LINE 3909 in phpthumb.class.php: added >>>> header('Cache-Control:'); <<<< to the logic.
if (function_exists('ImageTypes')) {
$imagetypes = ImageTypes();
if ($imagetypes & IMG_PNG) {
header('Content-Type: image/png');
header('Cache-Control:');
ImagePNG($gdimg_error);
} elseif ($imagetypes & IMG_GIF) {
header('Content-Type: image/gif');
header('Cache-Control:');
ImageGIF($gdimg_error);
} elseif ($imagetypes & IMG_JPG) {
header('Content-Type: image/jpeg');
header('Cache-Control:');
ImageJPEG($gdimg_error);
} elseif ($imagetypes & IMG_WBMP) {
header('Content-Type: image/vnd.wap.wbmp');
header('Cache-Control:');
ImageWBMP($gdimg_error);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment