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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 18:29:46
Script start
Timing: Jan 18 2025 18:29:46
Module start 'layout'
Timing: Jan 18 2025 18:29:46
Module start 'content'
Timing: Jan 18 2025 18:29:47
Module end 'content'
Timing: Jan 18 2025 18:29:47
Script end

Main resources:

Total runtime1.1800 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0042 587.7813152.6094
Module start 'layout' 0.00420.0021 740.390639.3984
Module start 'content' 0.00641.1723 779.7891538.6641
Module end 'content' 1.17860.0014 1,318.453112.2031
Script end 1.1800  1,330.6563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2609160.0002
Check MTime0.00130.1063160.0001
Mysql Total
Database connection0.00060.047310.0006
Mysqli_queries1.132795.9865570.0199
Looping result0.00070.0556550.0000
Template Total1.153297.720.5766
Template load0.00200.167720.0010
Template processing1.151397.561220.5756
Template load and register function0.00020.017810.0002
states
state_id_array0.00140.118710.0014
state_identifier_array0.00190.160520.0009
Override
Cache load0.00170.1439310.0001
Sytem overhead
Fetch class attribute can translate value0.00070.063220.0004
Fetch class attribute name0.00140.115340.0003
XML
Image XML parsing0.00060.052320.0003
class_abstraction
Instantiating content class attribute0.00000.000840.0000
General
dbfile0.00080.0718170.0000
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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