Closed ogrosko closed 6 years ago
Hi ogrosko,
this issue was fixed in 0.3.1 Are you sure you are using the latest version?
@saphrus Yes I'm using latest version from typo3-ter
"typo3-ter/mr-tinypng" : "0.3.1",
Hi ogrosko,
as far as i can see your system is trying so send an svg, what should actually not be possible, since mr_tinypng checks wether your file is a png or a jpeg before it is sent to the tinify-api. I will have a look into this on next tuesday (after easter weekend ;)).
Hi ogrosko, the problem with unsupported mime types was fixed at Version 0.3.1. Which TYPO3 and PHP version has your installation?
Hmm wierd I am using typo3 v7.6.4 and php v5.6
Is the correct version in typo3 ter?
Using the latest version v0.3.3 from dev-master I'm still getting same error. Would be also possible to use composer versioning e.g. git tagging, or update latest typo3-ter version?
Hi I made little investigation
In method \Scarbous\MrTinypng\Service\TinypngService->shrinkImage() I'm receiving images but all types. So it crashes when in my case image /typo3conf/ext/bb_boilerplate/Resources/Public/Images/wsw_neu_rgb.svg comes for shrinking
So I thnik there is also necessary check mime-type of image like in \Scarbous\MrTinypng\SignalSlots\FileProcessingService->preFileProcess
Temporary I fix this bug as follow:
public function shrinkImage($source, $target = NULL) { if (!in_array(mime_content_type($source), array('image/jpeg', 'image/png'))) return; //...
Thank you @ogrosko. I will add it to the extension. In a future Version I need this because it will shrink Images from CSS, so I have to check the mime-type.
@Scarbous Your fix is wrong. please change it from
if (!in_array(mime_content_type($source), array('image/jpeg', 'image/png'))) {
to
if (in_array(mime_content_type($source), array('image/jpeg', 'image/png'))) {
also you uses 'image/jpeg' and 'image/png' on multiple places. Use it as const or public property etc.
:+1:
Can you also update extension in TYPO3 TER?
Hi
First of all great extension! I'm using tinypng but I was looking for something automatic for typo3
But sometimes I get following error:
Invalid source specified (HTTP 400/JSON validation error)
I have to refresh page and than it works. But with caching no, so after error occur whould be great to clear caches.
It looks like it trys to compress unsupported image format (in this case svg). Or am I wrong?