I modified the thumbnail function in mezzanine_tags.py like below which at 
least prevents the 500 and enabled me to delete the offending image file 
using the normal Media Library file listing functionality.

    try:
        image = image.convert("RGBA")
    except:
        # Corrupt image file?
        return image_url


On Tuesday, April 15, 2014 4:32:20 PM UTC-5, Doug Evenhouse wrote:
>
> Hello folks,
>
> I have a new site that is returning a 500 error whenever the user tries to 
> access the Media Library. I was unable to find any errors in any of the 
> logs but after changing the DEBUG setting to True I was able to see that 
> the error is occurring when one of the images is being rendered as a 
> thumbnail. 
>
> The error is: 
> IOError at /admin/media-library/browse/
> image file is truncated (23 bytes not processed)
>
> and occurs in the file:
>
> lib/python2.7/site-packages/filebrowser_safe/templates/filebrowser/include/filelisting.html
>
> at line 75:
> <a href="{{ file.url }}" target="_blank"><img src="{{ MEDIA_URL }}{% 
> thumbnail file.path 60 60 %}" title="{% trans 'View Image' %}" /></a>
>
> The error happens here in mezzanine_tags.py:
> Line 345: 
>
>         image = image.convert("RGBA")
>
>
> This started happening after the user uploaded five images. It seems that 
> at least one of them is corrupted or something. How can I prevent the 500 
> error? The thumbnail template tag method seems to be coded to catch most 
> exceptions but this one is still getting through. I'm a little over my head 
> when it comes to coding up these try - except blocks.
>
> I am going to try to manually remove the offending image file(s) but I 
> hate to have the server throw 500 errors rather than just complain that the 
> thumbnail could not be generated or something more friendly.
>
> Any help on catching this exception will be much appreciated.
>
> Thanks,
> Doug
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to