HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


v7.0.1 - Strange bug with animated gif avatars

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#87157 (In Topic #17779)
Avatar

Community saint

Ok, Here is a strange one O_o.

On my site I'm using 75x75 avatars and one of my members chose this:

This avatar is actually 175x75 yet ocportal accepted it. Windows sees this as 49x66, and I suspect that ocportal thinks the same, which I assume is the size of the first frame and not that of the largest frame.

I don't particularity mind it as it looks good when shown in forum posts, but its inconsistent everywhere else. On the member profile page it appears in a lopsided border, and if it was in a blog post it would appear off-centre and the fireball gets cut off by the avatar box.

Of course if anything bigger slips-through then it could end up looking really ugly.

I'm guessing this is still happening in later versions.



Last edit: by temp1024

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#87171
Avatar

Strange one that. I agree with what you're saying, however the PHP GD library that we use doesn't support animated gifs, so it'll just see it as a single frame. You could try reporting this issue to the GD people and see if they'll make it smarter, but to resolve we'd have to implement our own gif file parser in ocPortal, which is prohibitive.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Item has a rating of 5 (Liked by Chris GrahamLiked by FletchLiked by BobSLiked by Jean)  
Rating:
#87177
Avatar

Community saint

Or, option 3 would be to change:

Code

         $sx=imagesx($source);
         $sy=imagesy($source);
to:

Code

         if(get_file_extension($avatar_url)=='gif')
         {
            $header = unpack ('@6/'.'vwidth/'.'vheight', $from_file);
            $sx=$header['width'];
            $sy=$header['height'];
         } else
         {
            $sx=imagesx($source);
            $sy=imagesy($source);
         }
In function ocf_member_choose_avatar of sources/ocf_members_action2.php .
  ;)

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#87178
Avatar

Wow, well done :). I was literally just going to take a look after reviewing exactly what GD was doing. I had assumed that GD was getting the "Logical Screen Descriptor" dimensions, and that we'd need to do a deeper parse to get it all – but you're right, it was getting it for the first frame, and the "Logical Screen Descriptor" is actually easy to get and guaranteed to fit any frame within it.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Important!
Posted
Item has a rating of 5 (Liked by Jean)  
Rating:
#87179
Avatar

Automated fix message

temp1024 said

Or, option 3 would be to change:

Code

         $sx=imagesx($source);
         $sy=imagesy($source);
to:

Code

         if(get_file_extension($avatar_url)=='gif')
         {
            $header = unpack ('@6/'.'vwidth/'.'vheight', $from_file);
            $sx=$header['width'];
            $sy=$header['height'];
         } else
         {
            $sx=imagesx($source);
            $sy=imagesy($source);
         }
In function ocf_member_choose_avatar of sources/ocf_members_action2.php .
  ;)
This issue has been filed on the tracker as issue #621, with a fix.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Important!
 
Posted
Item has a rating of 5 (Liked by Chris GrahamLiked by BobSLiked by Jean)  
Rating:
#87181
Avatar

Community saint

Chris Graham said

the "Logical Screen Descriptor" is actually easy to get and guaranteed to fit any frame within it.
Yep, and if you did do a deep inspection of each frame you would find that you couldn't always guarantee to make the numbers work anyway.

For example, if we look at the largest frame in the above animation we get:

Code

154 x 64 <- Largest frame size
 16 x 10 <- corner position in logical screen (i.e. offset)
========
170 x 74 <- Less then the 175 x 75 LSD

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: