R
R
restyler2015-05-18 01:02:21
Yii
restyler, 2015-05-18 01:02:21

Dynamic image generation in yii2 - which extension to choose?

There is a need to generate images (thumbnails, for example) on the fly (at the first render) and put them into a directory for further fast return. The path to the original image is stored in the database, and the presets are generated and cached (for example, the Drupal image system, the former imagecache).
Most of the extensions that I could find are too low-level (they assume that the developer takes over the issue of generating and storing the thumbnail in fs).
The closest I found:
https://github.com/pavlinter/yii2-display-image
But the quality of the code and the logic of parameter naming are not at all satisfactory, unfortunately.
Maybe someone has other options, or is it easier to write your own based on https://github.com/yiisoft/yii2-imagine ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mylistryx, 2015-05-18
@Mylistryx

Maybe I did not quite understand the question correctly, but I would create a rule for Apache / nginx that if the file does not exist at the FS level, then request this file through a script with parameters.
Example File '
/assets/posts/thumb/345345223ab7f8c0eab.jpg' requested folder above the DOCUMENT_ROOT folder) If there is, then resize it under the thumb profile, apply a watermark if necessary, put it in /assets/post/thumb, give it to the user. Otherwise, return 404.

R
Roman Frank, 2015-05-18
@Akellacom

I used yii2-imagine for previews, but it created them when the original image was uploaded to the server.
The first yii had an extension www.yiiframework.com/extension/iwi , which actually created a preview on the first render.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question