Hi!
I want to create greyscaled versions of color images for a hover effect. In my template I am doing this:
$is = new ImageSizer('/path/to/filename.ext');
$is->convertToGreyscale('/path/to/filename_new.ext');
(In my real code I am using filenames from page fields – the above code is just a shortened example.)
Doing this, the original files always are overwritten. I checked the source code and found, that the optional parameter $dstFilename isn't passed through when calling convertToGreyscale. $dstFilename get's lost in /wire/core/ImageSizer.php:
/**
* Convert image to greyscale (black and white)
*
* @return bool
*
*/
public function convertToGreyscale() {
return $this->getEngine()->convertToGreyscale();
}
I changed the method in /wire/core/ImageSizer.php to the follwoing code:
public function convertToGreyscale($dstFilename = '') {
return $this->getEngine()->convertToGreyscale($dstFilename);
}
Now, my template code works, but I changed a core file.
I am wondering, if this is an issue with ImageSizer or if I am doing it wrong. Do I have to call convertToGreyscale in some other way?