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