After I've installed a few copies of GS to my clients, I've noticed that they upload 3MB photos with resolution about 4000x4000 and place 20 photos on 1 page. So I developed plugin, that would handle each uploaded photo by resizing, cropping or compressing it automatically.
[h]Imagizer v 0.2 released![/h]
Changelog:
Requirements:
A few words about .bmp and compresion.
The GD php library doesn't support .bmp files, so I was forced to use non-core functions, which are not fast enough. Some optimization was made, but still, bmp picture may be loading in up-to 30 seconds, and I don't know what to do about it.
The new compression function also not so precize as it may seem. It tries to check file size and compress it to destination size, but, as I understand, jpeg compression is not easily predictable thing. Anyway, it can be used, and your pictures will be compressed, but don't expect them to be precisely the same size as you set in settings. And again (as it is with .bmp) any advice will be appreciated, because I don't know how to impreve this algorithm at the moment.
Imagizer runs great with GS 3.1, however GS 3.0 version is supported only with uploadify turned off (uncomment line in gsconfig.php file)
To-do list:
Settings explanation:
Variable size:
+
=
Explanation: one or more of picture's dimentions was bigger than maximum set in settings. Image was resized to fit maximum size, without changing aspect ratio.
+
=
Explanation: one or more of picture's dimentions was bigger than minimum set in settings. Image was resized to fit minimum size, without changing aspect ratio, but quality may be reduced, due to enlarging small picture.
+
=
Explanation: Picture width was bigger than maximum, but height smaller than minimum. Priority was set to maximum, so picture was resized to fit maximum requirements, without changing aspect ratio.
Exact size:
+
=
Explanation: First, picture was resized to fit height defined in settings. Than, left and right side was cropped to fit dimensions from settings. The algorithm automatically works out to fit width or height and what sides to crop (left and right or top and bottom) to lost lesser image area. Aspect ratio of figures on picture is saved, result picture aspect ratio could be calculated from settings set sizes. In addition, watermark with "TEST" text was added.
F.A.Q.:
How to determine wether uploadify is turned on/off:
[img=uploadify is on]http://web-line-studio.ru/imagizer/uploadify_on.png[/img]
[img=uploadify is off]http://web-line-studio.ru/imagizer/uploadify_off.png[/img]
How to disable Imagizer?
Simply deactivate it in plugins list!
How to determine whether GD2library works?
use this code somewhere on your server:
IMPORTANT
config.xml file in imagizer folder should be writeable, or else your settings won't be saved (thx AceLine)
[h]Imagizer v 0.2 released![/h]
Changelog:
- .bmp image support added (beta)
- settings labels i18n
- image watermarking
- image converting to .jpg
- image file compression
- all options save aspect ratio: portrait/landscape pictures will remain portrait/landscape
- some bugs fixes/code refactoring
Requirements:
- GD2 library - it is a part of PHP core, so it is installed on the most of hosters
A few words about .bmp and compresion.
The GD php library doesn't support .bmp files, so I was forced to use non-core functions, which are not fast enough. Some optimization was made, but still, bmp picture may be loading in up-to 30 seconds, and I don't know what to do about it.
The new compression function also not so precize as it may seem. It tries to check file size and compress it to destination size, but, as I understand, jpeg compression is not easily predictable thing. Anyway, it can be used, and your pictures will be compressed, but don't expect them to be precisely the same size as you set in settings. And again (as it is with .bmp) any advice will be appreciated, because I don't know how to impreve this algorithm at the moment.
Imagizer runs great with GS 3.1, however GS 3.0 version is supported only with uploadify turned off (uncomment line in gsconfig.php file)
Code:
define('GSNOUPLOADIFY', 1);
To-do list:
- make watermarking more customizable
- fix bugs, if any
- optimize/improve .bmp images loading/saving
- improve .jpeg images compression
- Thumbnail generation
Settings explanation:
Variable size:
+
=
Explanation: one or more of picture's dimentions was bigger than maximum set in settings. Image was resized to fit maximum size, without changing aspect ratio.
+
=
Explanation: one or more of picture's dimentions was bigger than minimum set in settings. Image was resized to fit minimum size, without changing aspect ratio, but quality may be reduced, due to enlarging small picture.
+
=
Explanation: Picture width was bigger than maximum, but height smaller than minimum. Priority was set to maximum, so picture was resized to fit maximum requirements, without changing aspect ratio.
Exact size:
+
=
Explanation: First, picture was resized to fit height defined in settings. Than, left and right side was cropped to fit dimensions from settings. The algorithm automatically works out to fit width or height and what sides to crop (left and right or top and bottom) to lost lesser image area. Aspect ratio of figures on picture is saved, result picture aspect ratio could be calculated from settings set sizes. In addition, watermark with "TEST" text was added.
F.A.Q.:
How to determine wether uploadify is turned on/off:
[img=uploadify is on]http://web-line-studio.ru/imagizer/uploadify_on.png[/img]
[img=uploadify is off]http://web-line-studio.ru/imagizer/uploadify_off.png[/img]
How to disable Imagizer?
Simply deactivate it in plugins list!
How to determine whether GD2library works?
use this code somewhere on your server:
Code:
<?php var_dump(gd_info()); ?>
IMPORTANT
config.xml file in imagizer folder should be writeable, or else your settings won't be saved (thx AceLine)