Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000297Friendica[All Projects] Generalpublic2012-02-24 15:112013-01-28 02:23
Reporteraracnus 
Assigned Tomacgirvin 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformwebOSlinux/unixOS Versionany
Product Versiondev 
Fixed in Version 
Summary0000297: Animated gif image converted to jpeg
DescriptionI sent the attached picture to my wall, the upload process was normal, but the picture is converted to jpeg on my media library. Is this normal? It's not possible to send animated gifs to friendica?
TagsNo tags attached.
Attached Filesgif file icon ilusao_giratoria.gif [^] (492,861 bytes) 2012-02-24 15:11
? file icon gif_resize.php [^] (516 bytes) 2012-07-21 02:59

- Relationships

-  Notes
(0000483)
macgirvin (administrator)
2012-02-24 16:08

Currently JPG is the only format supported by Friendica for storage. You can link to animated GIF's, but the PHP image libraries cannot deal with animations - for instance to scale them to thumbnails.
(0000714)
Domovoy (reporter)
2012-07-20 23:10

Actually, i never tested it, but i think PHP can deal with animations.
GD would be a bad choice for it, but imagemagick seems to be able to do a nice job.

I found this link: http://stackoverflow.com/questions/718491/resize-animated-gif-file-without-destroying-animation [^]

I think imagemagick can do everything you're actually doing with gd, so maybe it would be a good idea to switch to it?

I'll try this, and give you feedback.
(0000715)
Domovoy (reporter)
2012-07-21 02:59

I managed to resize an animated gif using Imagick.

On my setup the function saveImages seems to be broken, the resulting gif had only one frame, it took me some time before i could finally figure it and use a workaround.

I tried to find a way to do it with gd, but it seems almost impossible; one way would be to extract every frame of the gif and save them in a temporary folder, then resize each one of them, and finally reassemble each one of them as a gif. Doing that with gd would be almost the same as doing it "without" gd (using binary functions to explore the gif and create the resized one), and i guess it would be very slow.

I'm not very familiar with mantis yet, is there a way to attach some code to a post? (I'll use the upload file form for now)
(0000717)
Domovoy (reporter)
2012-07-21 08:27

I modified include/Photo.php to use Imagick:
The result is there: https://github.com/CyberDomovoy/friendica/tree/Imagick [^]

I tested it locally, it works great for uploading profile photos, and for posting too; gifs are now resized/croped/rotated... and the animation is not lost.

Looks like i'm not that good with git and github yet :) My local repo wanted to change a load of files, just because my editor changed their indentation or something. And if you look at the diff for Photo.php, you'll see that the same happened there (a lot of lines are removed just to be putted back with a different indentation :/) Any advice on how to handle this?
(0000718)
Domovoy (reporter)
2012-07-22 08:45

Since it was merged, i think this issue can be closed :)

My first commit to Friendica \o/

- Issue History
Date Modified Username Field Change
2012-02-24 15:11 aracnus New Issue
2012-02-24 15:11 aracnus File Added: ilusao_giratoria.gif
2012-02-24 16:08 macgirvin Note Added: 0000483
2012-07-20 18:51 Mike.T Issue Monitored: Mike.T
2012-07-20 23:10 Domovoy Note Added: 0000714
2012-07-21 02:59 Domovoy Note Added: 0000715
2012-07-21 02:59 Domovoy File Added: gif_resize.php
2012-07-21 03:03 Domovoy Issue Monitored: Domovoy
2012-07-21 08:27 Domovoy Note Added: 0000717
2012-07-22 08:45 Domovoy Note Added: 0000718
2013-01-28 02:23 macgirvin Status new => resolved
2013-01-28 02:23 macgirvin Resolution open => fixed
2013-01-28 02:23 macgirvin Assigned To => macgirvin


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker