require ROOT . '/library/preprocessor.php'; $imagePath = __TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/{$_GET['f']}"; if ($fp = @fopen($imagePath, 'r')) { if (isset($_GET['m']) && !empty($_GET['m'])) { if (file_exists($imagePath)) { $imageInfo = getimagesize($imagePath); $cropSize = $_GET['m']; $objThumbnail = new Utils_Image(); if ($imageInfo[0] > $imageInfo[1]) { list($tempWidth, $tempHeight) = $objThumbnail->calcOptimizedImageSize($imageInfo[0], $imageInfo[1], NULL, $cropSize); } else { list($tempWidth, $tempHeight) = $objThumbnail->calcOptimizedImageSize($imageInfo[0], $imageInfo[1], $cropSize, null); } $objThumbnail->imageFile = $imagePath; if ($objThumbnail->resample($tempWidth, $tempHeight) && $objThumbnail->cropRectBySize($cropSize, $cropSize)) { $objThumbnail->saveAsCache(); } unset($objThumbnail); } } else { $imageInfo = @getimagesize($imagePath); if (function_exists('gd_info')) { switch ($imageInfo[2]) { case 1: $image = imagecreatefromgif($imagePath); break; case 2: $image = imagecreatefromjpeg($imagePath); break; case 3: $image = imagecreatefrompng($imagePath);