Hi, I'm new to elgg and tidypic. I have it installed and noticed that some of my images that are animated gifs don't display as animated in the album. is there a way to do that? thanks
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Tidypics Team@tidypics
Tidypics Team - 0 likes
- tdnguyen16@mrmagic
tdnguyen16 - 0 likes
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
- tdnguyen16@mrmagic
tdnguyen16 - 0 likes
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
- Dagorath@Dagorath
Dagorath - 0 likes
You must log in to post replies.The images get resized and lose the animation in the process. I have never looked into resizing while maintaining the animation.
ok thanks, yeah i noticed that, i did some code changes to get the thumbs to properly resize on gif animations
Be interesting to see your code changes posted here for everyone else whi might be interested ;-) I suppose you reworked the code to decompose the gif into frames, thumbnail , do the resize and then re-assemble the frames back to store the animated gif ?
well fortunately my web host has imagemagick installed, so I was able to use that, but the method you mentioned above would be the alternative, more details i read are here:
http://stackoverflow.com/questions/718491/resize-animated-gif-file-without-destroying-animation
I have a custom use for elgg/tidypics. my site allows users to generate images / animated gifs and it stores those images to the gallery/user albums. here is the relevant code i did for it:
//create large thumb (note: changed to replace orig image as large thumb)
$fp = fopen($fileFullPath,'r');
$thumblarge = stream_get_contents($fp);
fclose($fp);
$thumb = new ElggFile();
$thumb->setMimeType($mime);
$thumb->setFilename($prefix."largethumb".$filestorename);
$thumb->open("write");
if ($thumb->write($thumblarge)) {
$file->largethumb = $prefix."largethumb".$filestorename;
}
else {
$thumb->delete();
}
$thumb->close();
//create thumbnail and thumbsmall
if ( $mime == 'image/gif') {
$fName = $fullpath . $name;
$coalesce = $fullpath . $baseName . "_coalesce.gif";
$commandline = "/usr/bin/convert " . $fName . " -coalesce " . $coalesce;
$output = shell_exec($commandline);
$newNameTh = $fullpath . $baseName . "_thumbnail.gif";
$commandline = "/usr/bin/convert -size 200x200 " . $coalesce.
" -resize 60x60! " . $newNameTh;
$output = shell_exec($commandline);
$newNameThSmall = $fullpath . $baseName . "_thumbsmall.gif";
$commandline = "/usr/bin/convert -size 200x200 " . $coalesce.
" -resize 153x153! " . $newNameThSmall;
$output = shell_exec($commandline);
$fpTh = fopen($newNameTh,'r');
$thumbnail = stream_get_contents($fpTh);
fclose($fpTh);
$thumb = new ElggFile();
$thumb->setMimeType($mime);
$thumb->setFilename($prefix."thumb".$filestorename);
$thumb->open("write");
if ($thumb->write($thumbnail)) {
$file->thumbnail = $prefix."thumb".$filestorename;
}
else {
$thumb->delete();
}
$thumb->close();
$fpSmall = fopen($newNameThSmall,'r');
$thumbsmall = stream_get_contents($fpSmall);
fclose($fpTh);
$thumb = new ElggFile();
$thumb->setMimeType($mime);
$thumb->setFilename($prefix."smallthumb".$filestorename);
$thumb->open("write");
if ($thumb->write($thumbsmall)) {
$file->smallthumb = $prefix."smallthumb".$filestorename;
}
else {
$thumb->delete();
}
$thumb->close();
}
else {
try {
$thumbsmall = get_resized_image_from_existing_file(
$file->getFilenameOnFilestore(),153,153, true);
$thumb = new ElggFile();
$thumb->setMimeType($mime);
$thumb->setFilename($prefix."smallthumb".$filestorename);
$thumb->open("write");
if ($thumb->write($thumbsmall)) {
$file->smallthumb = $prefix."smallthumb".$filestorename;
}
else {
$thumb->delete();
}
$thumb->close();
$thumbnail = get_resized_image_from_existing_file(
$file->getFilenameOnFilestore(),60,60, true);
$thumb = new ElggFile();
$thumb->setMimeType($mime);
$thumb->setFilename($prefix."smallthumb".$filestorename);
$thumb->open("write");
if ($thumb->write($thumbsmall)) {
$file->smallthumb = $prefix."smallthumb".$filestorename;
}
else {
$thumb->delete();
}
$thumb->close();
}
catch (Exception $e) { $thumbsmall = false; }
}
}
thx for posting yr code for gif anims.. i hope others find it useful. i remember someone was asking about gif anim for profiel icons. maybe they will see this.
yes, imagemajick does make it easier witht he one line conversion rather than gd's 4 command sequence ;-)
ok so i lied ;-)
GD will not do it in 4 commands.. rather 4 *steps.. each one involving lots of code ;-(
So if your host does not ImageMajick, but only GD.. you're kinda stuck.. ;-(
I was the one who wanted animated gifs for avatars. :p
I'm rewriting the avatar thing completely though.
ETA is about 200 years at this stage because there's so much else I have to do, hah.