October: DB Performance issue using the new resize feature

Created on 3 Oct 2020  路  2Comments  路  Source: octobercms/october

Using the new resize feature in my theme like so {{ image.path|resize(96, 96, {mode: "crop"}) }} querying the database in every sequence request because of:
https://github.com/octobercms/october/blob/f8f5e6e02273c81488542e51be50b5baed7a8af2/modules/system/classes/ImageResizer.php#L588

It should check if already resized after the first request and prevent from querying the database in the next request.

A page with 40-50 images using the resize will have too much queries in every request without a reason.

Question

All 2 comments

@panakour the quick fix for you is to not use the path property, just pass the image model by itself {{ image | resize(96, 96, {mode: "crop"}) }}

@LukeTowers thanks! this is solve the issue

Was this page helpful?
0 / 5 - 0 ratings