get($getStr); } catch(GenericException $e) { Response::setStatus(HTTP::INTERNAL_SERVER_ERROR); die((string)$e); } if($imageData instanceof HTTPResponse) { $tmpFile = $dir.DIRECTORY_SEPARATOR.md5(microtime()); file_put_contents($tmpFile, $imageData->getContent()); $image->load($tmpFile); unlink($tmpFile); } else { $tmpFile = $http->getTempFile(); $image->load($tmpFile); $http->cleanup(); } } else { $src = str_replace(SITEPATH, '', $src); $src = SITEPATH.DIRECTORY_SEPARATOR.trim($src, DIRECTORY_SEPARATOR); if(!file_exists($src)) { Response::setStatus(HTTP::NOT_FOUND); exit(); } $image->load($src); } Response::setHeader('Etag', "\"{$etag}\""); if(isset($_GET['w']) && is_numeric($_GET['w'])) { $width = (int)$_GET['w']; if(isset($_GET['h']) && is_numeric($_GET['h'])) { $height = (int)$_GET['h']; if(isset($_GET['t']) && $_GET['t']) { $image->applyFilter(new ScaleAndCropImage($width, $height)); } else { if($image->width >= $width || $image->height >= $height) { $image->applyFilter(new ScaleImage($width, $height)); } } } else { if($image->width >= $width || $image->height >= $height) { $height = $width * min($image->width,$image->height)/max($image->width, $image->height); $image->applyFilter(new ScaleImage($width, $height)); } } } elseif(isset($_GET['h'])) { $height = (int)$_GET['h']; $width = $height * min($image->width,$image->height)/max($image->width, $image->height); $image->applyFilter(new ScaleImage($width, $height)); } $image->save($imageFile, 'image/jpeg'); Response::setHeader('Content-Type', 'image/jpeg'); $image->output('image/jpeg'); } ?>