Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No thumbs generated on the list (S3) #103

Closed
tunarob opened this issue Jul 23, 2012 · 12 comments
Closed

No thumbs generated on the list (S3) #103

tunarob opened this issue Jul 23, 2012 · 12 comments
Assignees

Comments

@tunarob
Copy link

tunarob commented Jul 23, 2012

On /admin/filebrowser/browse/ I can't see images thumbs. I installed grappelli etc strict as documentation says. All works fine except thumb.
Their generated HTML source looks that:

<td class="fb_thumbnail">
    <a href="/site_media/media/uploads/c7e2b502ad416f525fa38cb94dfcd933.png" class="fb_viewlink"><img src="" title="Zobacz obraz"></a>
</td>```

EDIT:
does not generate thumbs in virtualenv.
@sehmaschine
Copy link
Owner

which versions of grappelli, filebrowser and django are you using?

@qntnrbns
Copy link

qntnrbns commented Aug 8, 2012

I am having the same problem using django 1.4.1, filebrowser 3.5.0, grappelli 2.4.0. This is a problem when I am serving media from s3, it does not seem to be generating versions when you upload media.

@fyaconiello
Copy link

I am also having this problem.

My implimentation involves the following versions:
Django==1.4
boto==2.5.2
django-filebrowser==3.5.0
django-grappelli==2.4.0
django-storages==1.1.5
django-tinymce==1.5.1b2

Looks like the thumbnail generation step fails for S3 hosted files.

@ghost ghost assigned sehmaschine Aug 9, 2012
@fyaconiello
Copy link

I found the issue. There is a slight bug before line 315 of the functions file. (see: https://github.com/sehmaschine/django-filebrowser/blob/master/filebrowser/functions.py#L315)

Solution

inserting the following snippet before line 315 solves the problem:

# Rewing the file pointer back to 0, before saving to the storage object
tmpfile.seek(0)

# Existing Code
site.storage.save(version_path, tmpfile)
return version_path

Debugging the Problem

I stepped through this function printing out the exception messages until I got this:
fp is at EOF. Use rewind option or seek() to data start.

Ex:

...
        return version_path
    except Exception, e:
        print e
        return None
...

@sehmaschine
Copy link
Owner

@fyaconiello shouldn´t that snippet be part of the s3-storage engine (with django-storages) instaed of adding it to the filebrowser?

@fyaconiello
Copy link

I thought it should be part of your library, however I posted the question to the community so others can weigh in:
http://stackoverflow.com/questions/12249458/bug-with-django-filebrowser-and-django-storages-which-library-is-at-fault

@philgyford
Copy link

Does this mean that dango-filebrowser doesn't currently work with S3? If so, what are the potential ways to solve this?

@sehmaschine
Copy link
Owner

here´s a related discussion: #40

we´re currently not working on filebrowser + s3. however, if someone comes up with a patch, we´re happy to implement it.

@nkeilar
Copy link

nkeilar commented Jun 13, 2013

Would be great if someone could clarify the change required to get this working. Is there and open pull request somewhere I can apply to django-filebrowser, django-grappelli or django-storages? Cheers!

@nkeilar
Copy link

nkeilar commented Jun 14, 2013

Since I was using sorl thumbnails in other areas of the site, I opted just to use that tag instead. Problem solved. Check out the modified template here. https://gist.github.com/madteckhead/5778759

@nkeilar
Copy link

nkeilar commented Jun 14, 2013

This also stops thumbnail files being saved locally in your MEDIA_ROOT which has probably been set to '' resulting in fules saved in an ugly place along with your application.

@sehmaschine
Copy link
Owner

see #283

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants