Ticket #1465 (closed enhancement: fixed)
EFM: prevent the creation of resized pictures (save disk space!)
|Reported by:||guest||Owned by:|
The trick is so simple and I had so much time wasted looking for a solution that I "need" to share it (take care, evil communism is on the way!).
A bad thing with ExtendedFileManager is that there are few configuration options for resized images: except resized_prefix and its directory (if PHP's safe mode is off), we can't control an algorithm that frequently creates new files (and we don't speak of tiny byte-scale configuration files, but pictures that can easily fill several megabytes).
In order to prevent this fanatic, byte-hungry behavior (don't be scared by words, they're only groups of ASCII codes!), you can use the following trick.
In the file xinha/plugins/ExtendedFileManager/resizer.php, in the beginning, get just after the if-block testing GET values 'img', 'width' and 'height' (which can lead to a call to js_fail because of a missing parameter), just add the line
Then the script will end right there, because of the exit command at the end of js_success, and will not create the resized picture, and then will save your disk space.
If you go at the end of the file, you'll see a call to js_success taking as a parameter the name of the newly created resized picture, so the trick above terminates the script in the same conditions than a "correct" exit.
If you are an addict of nicely written programs, just add an index in the $IMConfig, like 'resize_files' (just be sure your new index won't be in conflict with others), give it a value, then test it.
Then if you change your configuration value to 'true' you will have the same result as if you hadn't messed with the code.
You can, otherwise, bind the resizing to the IMConfig's safe_mode value instead of creating a new index, if you feel it would be good. You know what's good for you ;)