summaryrefslogtreecommitdiff
path: root/utils/thumbnail.php
diff options
context:
space:
mode:
authordeva <deva>2010-02-28 10:24:23 +0000
committerdeva <deva>2010-02-28 10:24:23 +0000
commita87d1861c843289cbc925fd26447a00621819ec8 (patch)
tree23d0c45f5f43546ba779d561a5fb344f5620628d /utils/thumbnail.php
parent7891a55bf66fdf38ffa515dd8c00f740096a670a (diff)
Remove old thumbnails file.
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