Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image type enforcement to Entity Brand asset field #1322

Open
simonkuran opened this issue May 25, 2023 · 3 comments
Open

Add image type enforcement to Entity Brand asset field #1322

simonkuran opened this issue May 25, 2023 · 3 comments

Comments

@simonkuran
Copy link

Is your feature request related to a problem? Please describe.

The SEOmatic > Site Settings > Identity > Entity Brand asset field notes "The image must be in JPG, PNG, or GIF format.", but it doesn't enforce this if an unsupported asset is used. When an SVG is uploaded everything seems successful in the CP, but the queue is gets 2-6ish "Generating image transform” jobs added to it quite often, sometimes several times per minute which bogs down the server CPU. There were some errors in the logs related to SEOmatic and the uploaded SVG so that's how I tracked down this issue (wish I had the exact log message, but it's since been overwritten.)

Describe the solution you would like

When selecting/uploading an unsupported image format to the Entity Brand field an error should be thrown and the image should not be used.

@khalwat
Copy link
Collaborator

khalwat commented May 25, 2023

Technically, depending on your underlying setup, using an SVG should actually work. Are you using GD or ImageMagick?

@simonkuran
Copy link
Author

Craft's System Report says Image driver & version: Imagick 3.7.0 (ImageMagick 6.9.10-23)

I was just able to recreate the error in the logs in a staging environment. OBGlogo_rgb.svg is a file uploaded to /assets/seo-images by the SEOmatic's Entity Brand field.

Queue Log

2023-05-26 09:37:12 [queue.INFO] [nystudio107\seomatic\Seomatic::init] SEOmatic plugin loaded {"memory":4703752} 
2023-05-26 09:37:12 [queue.INFO] [craft\queue\QueueLogBehavior::beforeExec]  [107151] t9n:["app","Generating image transform"] (attempt: 1, pid: 17712) - Started {"memory":7226616} 
2023-05-26 09:37:12 [queue.INFO] [nystudio107\imageoptimize\services\Optimize::saveTransformToTempFile] Transformed image saved to: /REDACTED-SERVER-PATH/storage/runtime/temp/OBGlogo_rgb64707dc8961084.26025693.svg {"memory":7681656} 
2023-05-26 09:37:12 [queue.ERROR] [nystudio107\imageoptimize\services\Optimize::executeImageProcessor] 	 does not exist {"memory":7682392} 
2023-05-26 09:37:12 [queue.INFO] [nystudio107\imageoptimize\services\Optimize::handleGenerateTransformEvent] OBGlogo_rgb.svg -> Original: 128.9 KB, Optimized: 128.9 KB -> Savings: 0.0% {"memory":7688840} 
2023-05-26 09:37:12 [queue.INFO] [craft\queue\QueueLogBehavior::afterExec]  [107151] t9n:["app","Generating image transform"] (attempt: 1, pid: 17712) - Done (time: 0.033s) {"memory":7555424} 
2023-05-26 09:37:12 [queue.INFO] [craft\queue\QueueLogBehavior::beforeExec]  [107152] t9n:["app","Generating image transform"] (attempt: 1, pid: 17712) - Started {"memory":7560448} 
2023-05-26 09:37:12 [queue.INFO] [craft\queue\QueueLogBehavior::afterExec]  [107152] t9n:["app","Generating image transform"] (attempt: 1, pid: 17712) - Done (time: 0.001s) {"memory":7562672} 
2023-05-26 09:37:12 [queue.INFO] [craft\queue\QueueLogBehavior::beforeExec]  [107153] t9n:["app","Generating image transform"] (attempt: 1, pid: 17712) - Started {"memory":7567744} 
2023-05-26 09:37:12 [queue.INFO] [nystudio107\imageoptimize\services\Optimize::saveTransformToTempFile] Transformed image saved to: /REDACTED-SERVER-PATH/storage/runtime/temp/OBGlogo_rgb64707dc89c8ad1.75499775.svg {"memory":7883472} 
2023-05-26 09:37:12 [queue.ERROR] [nystudio107\imageoptimize\services\Optimize::executeImageProcessor] 	 does not exist {"memory":7884208} 
2023-05-26 09:37:12 [queue.INFO] [nystudio107\imageoptimize\services\Optimize::handleGenerateTransformEvent] OBGlogo_rgb.svg -> Original: 128.9 KB, Optimized: 128.9 KB -> Savings: 0.0% {"memory":7885072} 
2023-05-26 09:37:12 [queue.INFO] [craft\queue\QueueLogBehavior::afterExec]  [107153] t9n:["app","Generating image transform"] (attempt: 1, pid: 17712) - Done (time: 0.018s) {"memory":7751656} 
2023-05-26 09:37:12 [queue.INFO] [craft\queue\QueueLogBehavior::beforeExec]  [107154] t9n:["app","Generating image transform"] (attempt: 1, pid: 17712) - Started {"memory":7756680} 
2023-05-26 09:37:12 [queue.INFO] [craft\queue\QueueLogBehavior::afterExec]  [107154] t9n:["app","Generating image transform"] (attempt: 1, pid: 17712) - Done (time: 0.001s) {"memory":7758904}

Web Log

2023-05-26 09:37:12 [web.INFO] [nystudio107\seomatic\Seomatic::init] SEOmatic plugin loaded {"memory":4683808} 
2023-05-26 09:37:12 [web.INFO] [nystudio107\imageoptimize\services\Optimize::saveTransformToTempFile] Transformed image saved to: /REDACTED-SERVER-PATH/storage/runtime/temp/OBGlogo_rgb64707dc85c94b0.23371411.svg {"memory":7629464} 
2023-05-26 09:37:12 [web.ERROR] [nystudio107\imageoptimize\services\Optimize::executeImageProcessor] 	 does not exist {"memory":7630200} 
2023-05-26 09:37:12 [web.INFO] [nystudio107\imageoptimize\services\Optimize::handleGenerateTransformEvent] OBGlogo_rgb.svg -> Original: 128.9 KB, Optimized: 128.9 KB -> Savings: 0.0% {"memory":7636648} 

This site also has ImageOptimize installed, but it does not have a field on the /assets/seo-images volume so it shouldn't touch this image. ImageOptimize also does not have an active image processor for SVGs configured. SVGO is not available on this server and all the ImageOptimize fields are configured to ignore SVGs so this shouldn't be a problem.

Does SEOmatic use ImageOptimize if it's installed? Maybe SEOmatic is assuming too much about the configured ImageOptimize capabilities?

@khalwat
Copy link
Collaborator

khalwat commented Jun 2, 2023

hmmmm, I will have a look at this, something isn't working as expected. I don't think ImageOptimize is relevant here though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants