[TYPO3-dev] A problem using image manipulation in my own class file
Tapio Markula
tapio.markula at xetpoint.fi
Wed Nov 19 18:13:36 CET 2008
> $imageFile= PATH_site .'uploads/pics/'.$content['image'];
> if(is_file($imageFile)) {
> $imageFile=$graphObj->imageMagickConvert($imageFile,'jpg','270','','','','',1);
> t3lib_div::debug($imageFile);
> ...
>
> result - no image will be created - got 'debug' from the debug function
> even if the input image really exists.
The problem relates with paths.
If the function has been called outside normal place, the $output
variable is not correct.
In that circumstance should use absolute path.
That should however strip off from the file name, which is needed
creating src="..."
I'm not however sure, if all here is ok.
// Register temporary filename:
$outputNopath=str_replace(PATH_site,'',$outputNopath);
$testOutputFile=PATH_site.$output;
$GLOBALS['TEMP_IMAGES_ON_PAGE'][] = $outputNopath;
if ($this->dontCheckForExistingTempFile ||
!$this->file_exists_typo3temp_file($testOutputFile, $imagefile)) {
$this->imageMagickExec($imagefile.$frame, $testOutputFile, $command);
}
if (@file_exists($testOutputFile)) {
$info[2] = $newExt;
$info[3] = $outputNopath;
$info[4] = $testOutputFile;
if ($params) { // params could realisticly change some imagedata!
$info=$this->getImageDimensions($info[4]);
}
if ($info[2]==$this->gifExtension && !$this->dontCompress) {
t3lib_div::gif_compress($info[4],'');
// Compress with IM (lzw) or GD (rle) (Workaround for the absence of
lzw-compression in GD)
}
$info[3] = $outputNopath;
unset($info[4]);
return $info;
}
Should I just create an XCLASS or should we create a core patch?
More information about the TYPO3-dev
mailing list