Browse Source

imagick converter: -thumbnail doesn't preserve exif, -resize does

disroot_master
zotlabs 2 years ago
parent
commit
156010050c
4 changed files with 6 additions and 6 deletions
  1. +1
    -1
      Zotlabs/Module/Cover_photo.php
  2. +1
    -1
      Zotlabs/Thumbs/Pdf.php
  3. +1
    -1
      Zotlabs/Thumbs/Video.php
  4. +3
    -3
      include/photos.php

+ 1
- 1
Zotlabs/Module/Cover_photo.php View File

@@ -95,7 +95,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
$fname = dbunescbin($r[0]['content']);
$tmp_name = $fname . '-001';
$newsize = photo_calculate_scale(array_merge(getimagesize($fname),['max' => $max_thumb]));
$cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $fname) . ' -thumbnail ' . $newsize . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmp_name);
$cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $fname) . ' -resize ' . $newsize . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmp_name);
// logger('imagick thumbnail command: ' . $cmd);
for($x = 0; $x < 4; $x ++) {
exec($cmd);


+ 1
- 1
Zotlabs/Thumbs/Pdf.php View File

@@ -27,7 +27,7 @@ class Pdf {

$imagick_path = get_config('system','imagick_convert_path');
if($imagick_path && @file_exists($imagick_path)) {
$cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmpfile . '[0]') . ' -thumbnail ' . $width . 'x' . $height . ' ' . escapeshellarg(PROJECT_BASE . '/' . $outfile);
$cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmpfile . '[0]') . ' -resize ' . $width . 'x' . $height . ' ' . escapeshellarg(PROJECT_BASE . '/' . $outfile);
// logger('imagick thumbnail command: ' . $cmd);
for($x = 0; $x < 4; $x ++) {
exec($cmd);


+ 1
- 1
Zotlabs/Thumbs/Video.php View File

@@ -46,7 +46,7 @@ class Video {

$imagick_path = get_config('system','imagick_convert_path');
if($imagick_path && @file_exists($imagick_path)) {
$cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmpfile . '[0]') . ' -thumbnail ' . $width . 'x' . $height . ' ' . escapeshellarg(PROJECT_BASE . '/' . $outfile);
$cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmpfile . '[0]') . ' -resize ' . $width . 'x' . $height . ' ' . escapeshellarg(PROJECT_BASE . '/' . $outfile);
// logger('imagick thumbnail command: ' . $cmd);

/** @scrutinizer ignore-unhandled */


+ 3
- 3
include/photos.php View File

@@ -80,8 +80,8 @@ function photo_upload($channel, $observer, $args) {
if($imagick_path && @file_exists($imagick_path)) {
$tmp_name = $args['os_syspath'] . '-001';
$newsize = photo_calculate_scale(array_merge($args['getimagesize'],['max' => $max_thumb]));
$cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $args['os_syspath']) . ' -thumbnail ' . $newsize . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmp_name);
// logger('imagick thumbnail command: ' . $cmd);
$cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $args['os_syspath']) . ' -resize ' . $newsize . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmp_name);
logger('imagick thumbnail command: ' . $cmd);
for($x = 0; $x < 4; $x ++) {
exec($cmd);
if(file_exists($tmp_name)) {
@@ -97,7 +97,7 @@ function photo_upload($channel, $observer, $args) {

$imagedata = @file_get_contents($tmp_name);
$filesize = @filesize($args['os_syspath']);
@unlink($tmp_name);
// @unlink($tmp_name);
}
else {
$imagedata = @file_get_contents($args['os_syspath']);


Loading…
Cancel
Save