aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Cover_photo.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-05-08 16:50:16 -0700
committerzotlabs <mike@macgirvin.com>2018-05-08 16:50:16 -0700
commitfbd26e8d9d5482961d5b0d0f2f10a38b2ea8009c (patch)
treee50b352bbdfa793c7e4cdcd848ef4e95e5e7f524 /Zotlabs/Module/Cover_photo.php
parent3c8de7b59d010f8273370c720aafde80067f77d7 (diff)
downloadvolse-hubzilla-fbd26e8d9d5482961d5b0d0f2f10a38b2ea8009c.tar.gz
volse-hubzilla-fbd26e8d9d5482961d5b0d0f2f10a38b2ea8009c.tar.bz2
volse-hubzilla-fbd26e8d9d5482961d5b0d0f2f10a38b2ea8009c.zip
changes made during testing imagick scaling for cover photo thumbnail
Diffstat (limited to 'Zotlabs/Module/Cover_photo.php')
-rw-r--r--Zotlabs/Module/Cover_photo.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php
index d0780c4de..9adfa2209 100644
--- a/Zotlabs/Module/Cover_photo.php
+++ b/Zotlabs/Module/Cover_photo.php
@@ -90,6 +90,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
if(intval($r[0]['height']) > $max_thumb || intval($r[0]['width']) > $max_thumb) {
$imagick_path = get_config('system','imagick_convert_path');
if($imagick_path && @file_exists($imagick_path) && intval($r[0]['os_storage'])) {
+
$fname = dbunescbin($r[0]['content']);
$tmp_name = $fname . '-001';
$newsize = photo_calculate_scale(array_merge(getimagesize($fname),['max' => $max_thumb]));
@@ -104,6 +105,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
if(file_exists($tmp_name)) {
$base_image = $r[0];
$gis = getimagesize($tmp_name);
+logger('gis: ' . print_r($gis,true));
$base_image['width'] = $gis[0];
$base_image['height'] = $gis[1];
$base_image['content'] = @file_get_contents($tmp_name);
@@ -148,10 +150,10 @@ class Cover_photo extends \Zotlabs\Web\Controller {
intval(local_channel())
);
- $orig_srcx = ( $r[0]['width'] / $scaled_width ) * $srcX;
- $orig_srcy = ( $r[0]['height'] / $scaled_height ) * $srcY;
- $orig_srcw = ( $srcW / $scaled_width ) * $r[0]['width'];
- $orig_srch = ( $srcH / $scaled_height ) * $r[0]['height'];
+ $orig_srcx = ( $base_image['width'] / $scaled_width ) * $srcX;
+ $orig_srcy = ( $base_image['height'] / $scaled_height ) * $srcY;
+ $orig_srcw = ( $srcW / $scaled_width ) * $base_image['width'];
+ $orig_srch = ( $srcH / $scaled_height ) * $base_image['height'];
$im->cropImageRect(1200,435,$orig_srcx, $orig_srcy, $orig_srcw, $orig_srch);