function convert($toMimetype, $x= 0, $y =0, $pg=false)
{
+ //print_R(func_get_args());
$pg = (int) $pg;
if(empty($pg) || is_nan($pg * 1)){
}
$x = strlen($x) ? (int) $x : '';
$y = strlen($y) ? (int) $y : '';
-// print_r($x);
-// print_r(' > ');
-// print_r($y);exit;
+ //print_r($x); print_r(' > '); print_r($y);exit;
$fn = $sc->runconvert($fn, $x, $y, $pg);
}
// broken image? for images...
$cmd = isset($this->lastaction->cmd) ? $this->lastaction->cmd : "No Method";
die("not available in this format was: {$this->mimetype}, request: {$this->to}<BR>
- Running - $cmd\n" . print_r($this->lastaction->log,true));
+ Running - $cmd\n" . print_r(is_object($this->lastaction) ? $this->lastaction->log : '',true));
}
clearstatcache();
if (!file_exists($this->target))
if (empty($this->debug) && file_exists($target) && filesize($target) && filemtime($target) > filemtime($fn)) {
-
return $target;
}
$targetName = $target;
break;
- default:
- $scale = "{$x}x{$y}>";
- $extent ="-extent '{$x}x{$y}>' -gravity center -background white -define jpeg:size={$x}x{$y}";
+ default:
+
+ list($width, $height) = @getimagesize($fn);
+
+ $scale = "{$x}x{$y}>";
+ $define = "-define jpeg:size={$x}x{$y}";
+ // if image required is bigger than the original - then we will just pad it..
+ if ($width < $x && $height < $y) {
+ $scale = '';
+ $define = '';
+ }
+ $extent ="-extent '{$x}x{$y}>' -gravity center -background white {$define}";
break;
}
require_once 'System.php';
$resize_method = filesize($fn) > 50000000 ? '-sample' : '-scale';
$cmd = "{$CONVERT} " . $strip . " -colorspace sRGB -interlace none -density 800 -quality 90 ".
- " {$resize_method} '{$scale}' ". $extent . " '{$fn}' '{$targetName}'";
-
+ (strlen($scale) ? " {$resize_method} '{$scale}' " : '' ).
+ $extent . " '{$fn}' '{$targetName}'";
+ //var_dump($cmd);exit;
$cmdres = $this->exec($cmd);
$this->exec($cmd);
function scaleImageC($fn, $x, $y)
{
-// print_r(array('scaleimage', func_get_args()));exit;
+ // print_r(array('scaleimageC', func_get_args()));exit;
if (empty($x) && empty($y)) {
return false;
}
// both x & y..
default:
- list($width, $height) = @getimagesize($fn);
-
- $resize = '-extent';
+
$scale = "{$x}x{$y}^";
$extent =" -gravity center -crop {$x}x{$y}+0+0";
break;