From: Bart Visscher Date: Mon, 13 Feb 2012 23:12:22 +0000 (+0100) Subject: Gallery: remove unused cover.php X-Git-Tag: v4.0.0beta~71^2~5^2~4^2~2^2~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=777804fac231f031ccbaed49590400dca91fab6b;p=nextcloud-server.git Gallery: remove unused cover.php --- diff --git a/apps/gallery/ajax/cover.php b/apps/gallery/ajax/cover.php deleted file mode 100644 index 068a6e9c4ec..00000000000 --- a/apps/gallery/ajax/cover.php +++ /dev/null @@ -1,81 +0,0 @@ -. -* -*/ - -require_once('../../../lib/base.php'); -OC_JSON::checkLoggedIn(); -OC_JSON::checkAppEnabled('gallery'); - -function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSrc is a FILE - Returns an image resource. - //getting the image dimensions - list($width_orig, $height_orig) = getimagesize($imgSrc); - switch (strtolower(substr($imgSrc, strrpos($imgSrc, '.')+1))) { - case "jpeg": - case "jpg": - $myImage = imagecreatefromjpeg($imgSrc); - break; - default: - exit(); - } - $ratio_orig = $width_orig/$height_orig; - - if ($thumbnail_width/$thumbnail_height > $ratio_orig) { - $new_height = $thumbnail_width/$ratio_orig; - $new_width = $thumbnail_width; - } else { - $new_width = $thumbnail_height*$ratio_orig; - $new_height = $thumbnail_height; - } - - $x_mid = $new_width/2; //horizontal middle - $y_mid = $new_height/2; //vertical middle - - $process = imagecreatetruecolor(round($new_width), round($new_height)); - - imagecopyresampled($process, $myImage, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig); - $thumb = imagecreatetruecolor($thumbnail_width, $thumbnail_height); - imagecopyresampled($thumb, $process, 0, 0, ($x_mid-($thumbnail_width/2)), ($y_mid-($thumbnail_height/2)), $thumbnail_width, $thumbnail_height, $thumbnail_width, $thumbnail_height); - - imagedestroy($process); - imagedestroy($myImage); - return $thumb; -} - -$box_size = 200; -$album_name = $_GET['album']; -$x = $_GET['x']; - -$stmt = OC_DB::prepare('SELECT `file_path` FROM *PREFIX*gallery_photos,*PREFIX*gallery_albums WHERE *PREFIX*gallery_albums.`uid_owner` = ? AND `album_name` = ? AND *PREFIX*gallery_photos.`album_id` == *PREFIX*gallery_albums.`album_id`'); -$result = $stmt->execute(array(OC_User::getUser(), $album_name)); -$x = min((int)($x/($box_size/$result->numRows())), $result->numRows()-1); // get image to display -$result->seek($x); // never throws -$path = $result->fetchRow(); -$path = $path['file_path']; -$imagePath = OC_Filesystem::getLocalFile($img); -$imagesize = getimagesize($imagePath); - -header('Content-Type: image/png'); -$image = CroppedThumbnail($imagePath, $box_size, $box_size); - -imagepng($image); -imagedestroy($image); -?>