diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-02-14 00:12:22 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-02-14 00:12:22 +0100 |
commit | 777804fac231f031ccbaed49590400dca91fab6b (patch) | |
tree | da6dd784a157cc3d4a23c6c155c1d61a135d0b98 /apps/gallery/ajax | |
parent | 525306c1e2930c6b378b0a4e9fb92eeb90865b0a (diff) | |
download | nextcloud-server-777804fac231f031ccbaed49590400dca91fab6b.tar.gz nextcloud-server-777804fac231f031ccbaed49590400dca91fab6b.zip |
Gallery: remove unused cover.php
Diffstat (limited to 'apps/gallery/ajax')
-rw-r--r-- | apps/gallery/ajax/cover.php | 81 |
1 files changed, 0 insertions, 81 deletions
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 @@ -<?php - -/** -* ownCloud - gallery application -* -* @author Bartek Przybylski -* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -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); -?> |