public function getImage($objUser) { $img = ImageCreateFromString(base64_decode($this->getFrom('imagedata', 'data'))); $objPicture = new clsPicture($this->get('picture_id')); if (!$objPicture->hasViewed($objUser)) { $newImage = clsThumbnail::getNewImage(); list($newWidth, $newHeight) = clsThumbnail::getNewSize(); ImageCopyMerge($img, $newImage, $this->get('actual_width') - $newWidth, $this->get('actual_height') - $newHeight, 0, 0, $newWidth, $newHeight, 75); ImageDestroy($newImage); } return $img; }
throw new Exception('exception_invalidrequest'); } if (isset($_REQUEST['tn']) || isset($_REQUEST['action']) && $_REQUEST['action'] == 'tn') { $intWidth = isset($_REQUEST['w']) ? $_REQUEST['w'] : -1; $intHeight = isset($_REQUEST['h']) ? $_REQUEST['h'] : -1; if (!is_numeric($intWidth) || $intWidth < 0 || $intWidth > MAX_X) { throw new Exception('exception_invalidrequest'); } if (!is_numeric($intHeight) || $intHeight < 0 || $intHeight > MAX_Y) { throw new Exception('exception_invalidrequest'); } $objThumbnail = clsThumbnail::getThumbnail($objUser, $objPicture->get('id'), $intWidth, $intHeight, $objAlbum); if (is_string($objThumbnail)) { throw new Exception($objThumbnail); } if ($objPicture->hasViewed($objUser)) { header('Last-modified: ' . $objThumbnail->get('date')); header('Expires: ' . (date('Y-m-d H:i:s') + 60 * 60 * 24)); header('Cache-control: public'); header('Pragma: public'); } $objThumbnail->setMime(); echo $objThumbnail->getImageRaw($objUser); } else { $objPicture->load(); header('Last-modified: ' . $objPicture->get('date')); header('Expires: ' . (date('Y-m-d H:i:s') + 60 * 60 * 24)); header('Cache-control: public'); header('Pragma: public'); $objPicture->setMime(); echo $objPicture->getImageRaw($objUser);