summaryrefslogtreecommitdiff
path: root/utils/thumbnail.php
diff options
context:
space:
mode:
Diffstat (limited to 'utils/thumbnail.php')
-rw-r--r--utils/thumbnail.php39
1 files changed, 0 insertions, 39 deletions
diff --git a/utils/thumbnail.php b/utils/thumbnail.php
deleted file mode 100644
index f1f4b38..0000000
--- a/utils/thumbnail.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-function thumbnail($album, $file, $maxwidth, $maxheight) {
- global $ALBUMS_DIR;
-
- if($file =="") return "No such image";
-
- // Config
- $quality = 70;
- $width = $maxwidth;
- $height = $maxheight;
-
- // Filenames
- $thumbnaildir = $ALBUMS_DIR . "/" . $album . "/thumbnails/";
- $thumbnail = $thumbnaildir . $maxwidth . "x" . $maxheight . "_" . $file;
- $original = $ALBUMS_DIR . "/" . $album . "/" . $file;
-
- if(!file_exists($thumbnaildir)) {
- // The thumbnaildir doesn't exist, create it.
- mkdir($thumbnaildir, 0755);
- }
-
- // Create thumbnail
- if(!file_exists($thumbnail)) {
- list($width_orig, $height_orig) = getimagesize($original);
- if ($width && ($width_orig < $height_orig)) {
- $width = ($height / $height_orig) * $width_orig;
- } else {
- $height = ($width / $width_orig) * $height_orig;
- }
- $image_p = imagecreatetruecolor($width, $height);
- $image = imagecreatefromjpeg($original);
- imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
- imagejpeg($image_p, $thumbnail, $quality);
- }
-
- // Return thumbnail filename
- return $thumbnail;
-}
-?> \ No newline at end of file