name = rawurldecode($opt['restAlias']); } } public function getMagicFile() { $zendMime = new Zend_Validate_File_MimeType(''); return $zendMime->getMagicFile(); } public function exec() { $info = Qs_ImageFs::getThumbnailInfo($this->name); $file = $width = $height = $force = $method = null; extract($info); if ($width || $height) { $name = Qs_ImageFs::resize( $file, array( 'width' => $width, 'height' => $height, 'force' => $force, 'method' => $method, 'sizeCheck' => true ) ); if (false !== $name) { $mimefile = $this->getMagicFile(); if (class_exists('finfo', false)) { $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME; if (!empty($mimefile)) { $mime = new finfo($const, $mimefile); } else { $mime = new finfo($const); } if ($mime !== false) { $type = $mime->file($name); } unset($mime); } if (empty($type) && (function_exists('mime_content_type') && ini_get('mime_magic.magicfile'))) { $type = mime_content_type($name); } if (!empty($type)) { header('Content-Type: ' . $type); header('Content-Length: ' . filesize($name)); if (ob_get_length()) { ob_clean(); flush(); } readfile($name); exit; } else { Qs_Http::redirect(BASE_URL . '/' . Qs_ImageFs::quotePath($name)); } } header('HTTP/1.0 404 Not Found'); exit; } else { Qs_Http::redirect(BASE_URL . '/' . Qs_ImageFs::quotePath($file)); } } }