aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorGreg Froese <greg.froese@gmail.com>2009-05-12 18:07:59 +0000
committerGreg Froese <greg.froese@gmail.com>2009-05-12 18:07:59 +0000
commita95c6c02347c847aa000d0d8e5db9b7bb3c5b3bd (patch)
treed016afcc8905fd887a1c739c96c6c90238de8508 /actions
parent30b3d62f17b48cbc4ce0e9322bb2e1d282a3afcb (diff)
downloadelgg-a95c6c02347c847aa000d0d8e5db9b7bb3c5b3bd.tar.gz
elgg-a95c6c02347c847aa000d0d8e5db9b7bb3c5b3bd.tar.bz2
made small thumbnail square again and put watermarking where it belongs
Diffstat (limited to 'actions')
-rw-r--r--actions/resize.php65
-rw-r--r--actions/upload.php4
2 files changed, 33 insertions, 36 deletions
diff --git a/actions/resize.php b/actions/resize.php
index 8a8a5bb34..5dfc30975 100644
--- a/actions/resize.php
+++ b/actions/resize.php
@@ -65,40 +65,37 @@
// If it's a file we can manipulate ...
if (array_key_exists($imgsizearray['mime'],$accepted_formats)) {
-// $function = "imagecreatefrom" . $accepted_formats[$imgsizearray['mime']];
-// $newimage = imagecreatetruecolor($newwidth,$newheight);
-
-// if (is_callable($function) && $oldimage = $function($input_name)) {
- // Crop the image if we need a square
- if ($square) {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = floor(($imgsizearray[0] - $width) / 2);
- $heightoffset = floor(($imgsizearray[1] - $height) / 2);
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = $width;
- }
- } else {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = 0;
- $heightoffset = 0;
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = ($y2 - $y1);
- }
- }//else {
- // Resize and return the image contents!
- if ($square) {
- $newheight = $maxheight;
- $newwidth = $maxwidth;
- }
- $command = "convert $input_name -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." $output_name";
- system($command);
- return $output_name;
+ // Crop the image if we need a square
+ if ($square) {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $widthoffset = floor(($imgsizearray[0] - $width) / 2);
+ $heightoffset = floor(($imgsizearray[1] - $height) / 2);
+ } else {
+ $widthoffset = $x1;
+ $heightoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = $width;
+ }
+ } else {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $widthoffset = 0;
+ $heightoffset = 0;
+ } else {
+ $widthoffset = $x1;
+ $heightoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = ($y2 - $y1);
+ }
+ }
+
+ // Resize and return the image contents!
+ if ($square) {
+ $newheight = $maxheight;
+ $newwidth = $maxwidth;
+ }
+ $command = "convert $input_name -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." $output_name";
+ system($command);
+ return $output_name;
}
}
diff --git a/actions/upload.php b/actions/upload.php
index 2f84a9f6b..de7c35324 100644
--- a/actions/upload.php
+++ b/actions/upload.php
@@ -130,12 +130,12 @@
$thumblarge = tp_resize($file->getFilenameOnFilestore(), "largethumb", 600, 600, false);
} catch (Exception $e) { $thumblarge = false; }
try {
- $thumbsmall = tp_resize($file->getFilenameOnFilestore(), "smallthumb", 153, 153, false);
+ $thumbsmall = tp_resize($file->getFilenameOnFilestore(), "smallthumb", 153, 153, true);
} catch (Exception $e) { $thumbsmall = false; }
try {
$thumbnail = tp_resize($file->getFilenameOnFilestore(), "thumb", 60, 60, true);
} catch (Exception $e) { $thumbnail = false; }
-
+
if ($thumbnail) {
$thumb = new ElggFile();
$thumb->setMimeType($mime);