M
M
Marina2018-09-17 16:44:29
1C-Bitrix
Marina, 2018-09-17 16:44:29

Fileman in Bitrix: is there a function to optimize images on upload?

Does anyone have a ready-made function for adding to init.php in bitrix, so that when uploading files via fileman, the image is immediately optimized (according to the width and height specified in the function) and the optimized one is saved, but the original one is not? Or at least tell me what event is worth catching in order to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2018-09-24
@Marinka83

Almost all such scripts are of dubious value.
In fact, by implementing this, it turns out that you deliberately lose in the speed of loading the image (after all, from the point of view of Bitrix, this is not only uploading a file to a folder, but also an additional series of server handlers that determine where exactly to put the file, register it in the system, etc.) . At the same time, the image quality itself as a result of such operations is rather doubtful (either it will not compress well, or it will require a lot of resources).
At the same time, connecting an external application (meaning through exec()) for the sake of one file does not make much sense.
It's easier once in a while to run a script on the crown that will get the real paths of all uploaded images and run them through a special. program.
PS I just edited it in response to make it clearer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question