Bug #14810 » class.t3lib_stdgraphic.php.diff
class.t3lib_stdgraphic.php 19 Jan 2006 16:01:58 -0000 | ||
---|---|---|
}
|
||
$command = $this->scalecmd.' '.$info[0].'x'.$info[1].'! '.$params.' ';
|
||
$md5ext = ($data['crs'] ? 'crs-V'.$options['cropV'].'H'.$options['cropH'] : '');
|
||
if ($this->alternativeOutputKey) {
|
||
$theOutputName = t3lib_div::shortMD5($command.basename($imagefile).$this->alternativeOutputKey.$frame);
|
||
$theOutputName = t3lib_div::shortMD5($command.$md5ext.basename($imagefile).$this->alternativeOutputKey.$frame);
|
||
} else {
|
||
$theOutputName = t3lib_div::shortMD5($command.$imagefile.filemtime($imagefile).$frame);
|
||
$theOutputName = t3lib_div::shortMD5($command.$md5ext.$imagefile.filemtime($imagefile).$frame);
|
||
}
|
||
if ($this->imageMagickConvert_forceFileNameBody) {
|
||
$theOutputName = $this->imageMagickConvert_forceFileNameBody;
|
||
... | ... | |
// Register temporary filename:
|
||
$GLOBALS['TEMP_IMAGES_ON_PAGE'][] = $output;
|
||
if ($this->dontCheckForExistingTempFile || !$this->file_exists_typo3temp_file($output,$imagefile)) {
|
||
if ($data['crs']) {
|
||
if ($this->dontCheckForExistingTempFile || !$this->file_exists_typo3temp_file($output,$imagefile)) {
|
||
$crsOutput = str_replace('pics/','pics/crs-',$output);
|
||
$this->imageMagickExec($imagefile.$frame,$crsOutput,$command);
|
||
$gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
|
||
$gifCreator->init();
|
||
if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) {
|
||
// $ofX = intval( ($data['origW'] - $data[0]) / 2);
|
||
// $ofY = intval( ($data['origH'] - $data[1]) / 2);
|
||
$ofX = intval( ($data['origW'] - $data[0]) * ($options['cropH']+100)/200);
|
||
$ofY = intval( ($data['origH'] - $data[1]) * ($options['cropV']+100)/200);
|
||
$tmpParm = Array('XY'=>intval($data['origW']).','.intval($data['origH']),
|
||
'backColor'=>'#00ff00',
|
||
'10' => 'IMAGE',
|
||
'10.' => Array( 'file'=> $crsOutput, 'offset'=> $ofX.','.$ofY),
|
||
);
|
||
$gifCreator->start($tmpParm,array());
|
||
$newoutput = $gifCreator->gifBuild();
|
||
if (!copy($newoutput,$output)) {
|
||
$output = $newoutput;
|
||
}
|
||
} else {
|
||
$output=$crsOutput;
|
||
}
|
||
}
|
||
} else if ($this->dontCheckForExistingTempFile || !$this->file_exists_typo3temp_file($output,$imagefile)) {
|
||
$this->imageMagickExec($imagefile.$frame,$output,$command);
|
||
}
|
||
if (@file_exists($output)) {
|
||
$info[3] = $output;
|
||
$info[2] = $newExt;
|
||
... | ... | |
*/
|
||
function getImageScale($info,$w,$h,$options) {
|
||
if (strstr($w.$h, 'm')) {$max=1;} else {$max=0;}
|
||
if (strstr($w.$h, 'c')) {$crs=1;} else {$crs=0;}
|
||
$out['crs'] = $crs;
|
||
$w=intval($w);
|
||
$h=intval($h);
|
||
// if there are max-values...
|
||
... | ... | |
$w = round($h*$ratio);
|
||
}
|
||
}
|
||
if ($crs) {
|
||
$ratio = $info[0]/$info[1];
|
||
if ($h*$ratio < $w) {
|
||
$h = round($w/$ratio);
|
||
} else {
|
||
$w = round($h*$ratio);
|
||
}
|
||
}
|
||
$info[0] = $w;
|
||
$info[1] = $h;
|
||
}
|
||
... | ... | |
if ($options['minW'] && $out[0]<$options['minW']) {
|
||
if ($max && $out[0]) {
|
||
$out[1]= round($out[1]*$options['minW']/$out[0]);
|
||
} else if ($crs && $out[0]) {
|
||
$out[1]= round($out[1]*$options['minW']/$out[0]);
|
||
}
|
||
$out[0]=$options['minW'];
|
||
}
|
||
if ($options['minH'] && $out[1]<$options['minH']) {
|
||
if ($max && $out[1]) {
|
||
$out[0]= round($out[0]*$options['minH']/$out[1]);
|
||
} else if ($crs && $out[1]) {
|
||
$out[0]= round($out[0]*$options['minH']/$out[1]);
|
||
}
|
||
$out[1]=$options['minH'];
|
||
}
|