Forums / Setup & design / Image filters

Image filters

Author Message

Jérôme Vieilledent

Thursday 30 August 2007 3:23:29 am

Hello,

I would like to add an alias "thumbnail" to images uploaded. This thumbnail must be square (like 100*100). The idea is to scaledown first the image uploaded and then cropping it to obtain a square (the inverse is also possible : crop and then scaledown).

The problem is that I must match the shorter side to have a clean square, or at least I have to know the size of the original image to then use it to crop with the right side size.

Do you know if something like that is possible ? Or maybe it's possible to define a new imageFilter...

Thanks

Georg Franz

Thursday 30 August 2007 3:40:14 am

Hi Jérôme,

try this in your image.ini.append

[AliasSettings]
...
AliasList[]=smallpic

[ImageMagick]
...
Filters[]=thumb=-resize 'x%1' -resize '%1x<' -resize 50%
Filters[]=centerimg=-gravity center -crop %1x%2+0+0 +repage
Filters[]=strip=-strip

[smallpic]
Reference=
Filters[]
Filters[]=thumb=200
Filters[]=centerimg=100;100
Filters[]=strip=

It's not perfect, but it works:
-) First you scale the image twice big as you want to have it in the final result (in that case 200 px)
-) Then you resize it to 50%
-) Then you crop it

The last "strip" strips off exif infos from the image.

If you have "normal" pictures it should work.

HTH

Best wishes,
Georg.

Best wishes,
Georg.

--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004

Jérôme Vieilledent

Thursday 30 August 2007 5:34:42 am

Hello Georg and thanks for your reply :-)

I've never used ImageMagick, and so I don't really understand the filters you describe (Is there somewhere an explanation about how to use these settings ?), I don't understand what does mean %1,...

Is it possible to do such a thing with standard GD2 ?
In PHP manual coding, what I usually do is first measuring the image, take the smallest value and crop with that value, and then I resize. The thing is that here I can't know the size of the image by advance... So I can't crop precisely.

Is there an issue for that ?

And about ImageMagick, do I have to change something in the image.ini.append.php to use it ? I think I must have ImageMagick installed on my computer, ain't I ?

Thanks for your help

Georg Franz

Thursday 30 August 2007 6:16:28 am

Hi Jérôme,

install and use ImageMagick, it's better than GD2.

Ignore the %1 in the filter settings, it's just a placeholder for the first value from the image ini block. (%2 for the 2nd and so on.)

Example image.ini for IM:
[ImageMagick]
IsEnabled=true
ExecutablePath=
Executable=convert
ExecutableWin32=convert
ExecutableUnix=/usr/bin/convert

More infos about crop + thumbnails from IM:
http://www.imagemagick.org/Usage/crop/
http://www.imagemagick.org/Usage/thumbnails/

Best wishes,
Georg.

--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004

Jérôme Vieilledent

Saturday 01 September 2007 7:13:37 am

Thank you, I will try :-)

Stéphane Bullier

Sunday 02 September 2007 11:04:14 pm

Hi,

You can find info here : http://ez.no/download/ez_publish/changelogs/ez_publish_3_3/new_image_system

Stéphane

meinhard benn

Saturday 08 August 2009 10:11:24 am

thanks, georg!

to increase quality of my thumbnails i added a quality setting and a sharpening filter. from my image.ini.append.php:

[ImageMagick]
Filters[]=thumb=-resize 'x%1' -resize '%1x<' -resize 50% -quality 90
Filters[]=centerimg=-gravity center -crop %1x%2+0+0 +repage
Filters[]=sharpen=-sharpen 0.5

[gallerythumbnail]
Reference=
Filters[]
Filters[]=thumb=200
Filters[]=centerimg=100;100
Filters[]=sharpen=

cheers, meinhard.

http://goozee.benn.org/ - Google Co-op for eZ sites

eZ debug

Timing: Jan 18 2025 15:13:26
Script start
Timing: Jan 18 2025 15:13:26
Module start 'content'
Timing: Jan 18 2025 15:13:27
Module end 'content'
Timing: Jan 18 2025 15:13:27
Script end

Main resources:

Total runtime0.1758 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.7188180.8516
Module start 'content' 0.00580.0051 769.5703101.8203
Module end 'content' 0.01090.1648 871.3906530.2266
Script end 0.1757  1,401.6172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00362.0519200.0002
Check MTime0.00130.7428200.0001
Mysql Total
Database connection0.00060.317510.0006
Mysqli_queries0.130574.25921410.0009
Looping result0.00130.76381390.0000
Template Total0.164593.610.1645
Template load0.00080.444910.0008
Template processing0.163793.103710.1637
Override
Cache load0.00050.305410.0005
Sytem overhead
Fetch class attribute can translate value0.00080.460210.0008
XML
Image XML parsing0.00030.145010.0003
General
dbfile0.00351.9944200.0002
String conversion0.00000.003430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs