Forums / General / geometry/crop

geometry/crop

Author Message

Ben Pirt

Thursday 15 January 2004 3:30:05 am

Hello All,
I have been using the new image system, which is working nicely. Although I have just tried to use the geometry/crop filter and it was not applied. I am using GD, not ImageMagick. Does this operation require IM?

Also, I was thinking that a nice extension to the crop command might be to centre the crop on the image. e.g. if the image is 60px high to be cropped to 4opx, the crop would be 10px into the image.

As well as this, the scale command could do with an addition, so that you can scale the smallest dimension to a particualr size.

Basically, these two suggestions/requests come out of me trying to create a square icon. There would be two operations to achieve this;
1) scale down so that the smallest dimension is equal to the required side length
2) crop the image (centred) to the side length

At the moment, I have to have two image operators, and do a test in the template to see if the height or width is the longest dimension and then use the correct image accordingly.

Still, the new image mechanism is a vast improvement over the last one. Particularly th naming and location of the files.

All the best,
Ben Pirt

Ben Pirt

Thursday 15 January 2004 3:47:05 am

OK, I've figured out why it was not cropping, my code was;

Filters[]=geometry/crop=40,40,0,0

as per the documentation here;
http://ez.no/developer/ez_publish_3/releases/ez_publish_3_3/new_image_system

but after looking in the templates, you need semi colon seperators as;

Filters[]=geometry/crop=40;40;0;0

Someone should make a quick fix to the documentation to avoid future confusion, but I hope this helps someone.

Cheers,
Ben

Jan Borsodi

Wednesday 21 January 2004 1:41:07 am

The documentation has been updated.

As for the scale and crop requests, they should be doable but requires some additions to the image handlers.
For instance to get support for this for ImageMagick we would have to have some more keywords to use in the parameter strings, for instance the size of the image to scale from, perhaps also some basic arithmetic operations.

Also it can be problematic to know the size of an image, we must either rely on the builtin functions in PHP to do this (but they don't support many formats) or create custom code to figure out the size.
Formats such as JPEG, GIF and PNG shouldn't be a problem though.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

eZ debug

Timing: Jan 18 2025 15:17:58
Script start
Timing: Jan 18 2025 15:17:58
Module start 'content'
Timing: Jan 18 2025 15:17:59
Module end 'content'
Timing: Jan 18 2025 15:18:00
Script end

Main resources:

Total runtime1.2785 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0080 587.5313180.8594
Module start 'content' 0.00801.1217 768.3906543.7188
Module end 'content' 1.12970.1487 1,312.1094332.7813
Script end 1.2784  1,644.8906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.3366210.0002
Check MTime0.00160.1257210.0001
Mysql Total
Database connection0.00110.083110.0011
Mysqli_queries1.199293.79621940.0062
Looping result0.00190.14671920.0000
Template Total1.234196.520.6171
Template load0.00220.171420.0011
Template processing1.231996.354720.6160
Template load and register function0.00020.018410.0002
states
state_id_array0.00110.088310.0011
state_identifier_array0.00100.078820.0005
Override
Cache load0.00180.1426310.0001
Sytem overhead
Fetch class attribute can translate value0.00150.120230.0005
Fetch class attribute name0.00160.124040.0004
XML
Image XML parsing0.00090.067530.0003
class_abstraction
Instantiating content class attribute0.00000.000840.0000
General
dbfile0.00950.7437280.0003
String conversion0.00000.000530.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs