Forums / Developer / Animated gif - flatten or deny

Animated gif - flatten or deny

Author Message

Piotrek Karaś

Monday 26 May 2008 2:33:05 am

Hi,

How do I configure image.ini settings to disallow animated *.gif files from the system? Two situations will be acceptable for me:
1) The system refuses to accept an image if it's recognized as animated gif
2) The system flattens an animated gif (creates one frame and applies all other filters).

So far all the combinations we've tried have failed... ;(

Any suggestions?
Thanks!

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Felix Laate

Monday 26 May 2008 6:58:09 am

Hi Piotrek,

AFAIK convert has an option <i>-adjoin</i> that will join images into a single multi-image file. Maybe you could use that?

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Piotrek Karaś

Tuesday 27 May 2008 3:03:19 am

Hi Felix,

Thanks. Unfortunately, that didn't do the trick... or maybe I haven't used that filter properly... Still stuck, anyways...

BTW. Is it possible to deny *.gif files alltogether?

Thanks,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Piotrek Karaś

Tuesday 27 May 2008 5:04:23 am

Seems like <b>-delete 1--1</b> should be a perfect solution (get rid of all the layers counting the second one to the last one), but unfortunately my library doesn't accept that argument, even though it seems valid... For now I end up with semi-fine <b>-flatten</b>, which simply gets rid of the layers for the original alias, but all the layers underneath are visible...

If anyone has a better solution - I would be grateful!
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Bartek Modzelewski

Tuesday 27 May 2008 5:41:45 am

Hi Piotrek,

Have you tried to convert gif to jpeg or png? For ex:

ConversionRules[]=image/gif;image/png

I'm almost sure that such conversion will remove all frames except first one.

I've also found in <i>image.ini</i> file such part:

# Override for animated GIFs, this is needed to properly
# handle image/gif files with multiple image frames.
# It will turn off any geometry filters to leave the images untouched.
[AnimatedGIF]
# The MIME type which this override works on
MIMEType=image/gif
# A list of matches that needs to be satisified for this override to be used
Match[is_animated]=1
# Alternative MIME type for the image, currently unused.
OverrideMIMEType=animation/gif
# A list of filters which are not allowed to be run on this image,
# wildcards can also be used.
DisallowedFilters[]=*
# A list of filters which are allowed to be run on this image,
# wildcards can also be used. If this is supplied only filters that
# are in this list will be allowed
# AllowedFilters[]

so having <i>DisallowedFilters[]=*</i> makes impossible to use any filter for animated GIFs... at least that's how I understand it.
Maybe removing this will help you...

Good luck

Baobaz
http://www.baobaz.com

Piotrek Karaś

Tuesday 27 May 2008 9:55:57 am

Hey Bartek,

Thanks for the tip, but we've already tried with two parts of image.ini that you mentioned. Unfortunately, it seems like they have no effect whatsoever on our installation... I don't get it... Imagemagick is fine, custom filters work fine (except for those little problems), but the ConversionRules seem to be completetly ignored...

Well, we keep looking ;)
BTW. This is 4.0.0...

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Bartek Modzelewski

Tuesday 27 May 2008 1:59:19 pm

Piotrek: you were right, it just doesn't work :)

But: It seems that eZGIF analyzer doesn't recognize properly GIF version. I just commented out line

Match[is_animated]=1

and it works! Having the following settings:

[AnimatedGIF]
MIMEType=image/gif
#Match[is_animated]=1
OverrideMIMEType=animation/gif
#DisallowedFilters[]=*
AllowedFilters[]
AllowedFilters[]=flatten

i managed to have static GIF. Of course this way it also converts static GIFs uploaded, but - this is not a problem.

This solution should be treated as workaround, because there is definitely sth wrong with eZGIFImageAnalyzer.

If you want to completly disable GIF images, you can simply comment line

#AllowedOutputFormat[]=image/gif

, but this won't protect from uploading GIF images (won't display any error, just won't display uploaded image).

( eZ Publish 4.0.0 / Ubuntu Hardy / ImageMagick )

Hope it helps this time :)

Baobaz
http://www.baobaz.com

Piotrek Karaś

Tuesday 27 May 2008 8:49:56 pm

Bartek,

We'll test it in few moments, thanks a lot!
Meanwhile, it still seems like the biggest problem we have with imagemagick itself, as it lacks a good and reliable method for removing unnecessary layers in a simple way... Ones that should work - don't...

PS. This is my first steps with this library, haven't used that before, and I'm impressed by its complexity and power, but also I can't believe anyone has ever used that library for web purposes, as most of the problems I come across seem to have been solved and introduced two months ago or not at all ;)

Cheers,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

eZ debug

Timing: Jan 20 2025 14:28:53
Script start
Timing: Jan 20 2025 14:28:53
Module start 'content'
Timing: Jan 20 2025 14:28:54
Module end 'content'
Timing: Jan 20 2025 14:28:55
Script end

Main resources:

Total runtime1.1711 sec
Peak memory usage4,096.0000 KB
Database Queries211

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.9531180.8359
Module start 'content' 0.00511.0628 769.7891657.4766
Module end 'content' 1.06800.1030 1,427.2656345.0625
Script end 1.1710  1,772.3281 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.3099210.0002
Check MTime0.00130.1109210.0001
Mysql Total
Database connection0.00060.051210.0006
Mysqli_queries1.091293.17542110.0052
Looping result0.00180.15272090.0000
Template Total1.140397.420.5701
Template load0.00220.185020.0011
Template processing1.138197.182320.5690
Template load and register function0.00010.006410.0001
states
state_id_array0.00130.114810.0013
state_identifier_array0.00100.087220.0005
Override
Cache load0.00190.1663650.0000
Sytem overhead
Fetch class attribute can translate value0.00100.081440.0002
Fetch class attribute name0.00070.0625100.0001
XML
Image XML parsing0.00110.096140.0003
class_abstraction
Instantiating content class attribute0.00000.0020140.0000
General
dbfile0.00440.3782340.0001
String conversion0.00000.000430.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
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
20content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
8content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 49
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs