TND / django-files-widget

Django AJAX upload widget and model field for multiple files or images, featuring drag & drop uploading, upload progress bar, sortable image gallery
Other
88 stars 52 forks source link

Can not show thumbnails when deploy on linux #13

Open eromoe opened 9 years ago

eromoe commented 9 years ago

Problem in files_widget/views.py

    return HttpResponse(json.dumps({
        'success': True,
        'imagePath': path_to_file,
        'thumbnailPath': render_to_string('files_widget/includes/thumbnail.html', locals()),
    }))

render_to_string('files_widget/includes/thumbnail.html', locals())

return u'' on ubuntu 14.04 but working on windows 7 x64.

I am using pycharm remote debuging, though it can not debug into sorl.thumbnail(pydev debugger: warning: trying to add breakpoint to file that does not exist: /root/d:/python27/lib/site-packages/sorl_thumbnail-12.2-py2.7.egg/sorl/thumbnail/templatetags/thumbnail.py (will have no effect)). So I don't know what cause this problem, please check it.

eromoe commented 9 years ago

OK, I find the path mapping seems can make me debug into thumbnail.

[ERROR][2015-04-27 19:36:42,498][django.request][Line:231] Internal Server Error: /files-widget/thumbnail-url/
Traceback (most recent call last):
  File "/data/www/housemgr/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/data/www/housemgr/venv/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/data/www/housemgr/src/topnotchdev/files_widget/views.py", line 60, in thumbnail_url
    thumbnail_url = ImagePath(request.GET['img']).thumbnail(request.GET['preview_size']).url
  File "/data/www/housemgr/src/topnotchdev/files_widget/controllers.py", line 160, in thumbnail
    self._thumbnails[key] = get_thumbnail(self.local_path, size, **attrs)
  File "/data/www/housemgr/venv/local/lib/python2.7/site-packages/sorl/thumbnail/shortcuts.py", line 8, in get_thumbnail
    return default.backend.get_thumbnail(file_, geometry_string, **options)
  File "/data/www/housemgr/venv/local/lib/python2.7/site-packages/sorl/thumbnail/base.py", line 124, in get_thumbnail
    thumbnail)
  File "/data/www/housemgr/venv/local/lib/python2.7/site-packages/sorl/thumbnail/base.py", line 156, in _create_thumbnail
    image = default.engine.create(source_image, geometry, options)
  File "/data/www/housemgr/venv/local/lib/python2.7/site-packages/sorl/thumbnail/engines/base.py", line 21, in create
    image = self.colorspace(image, geometry, options)
  File "/data/www/housemgr/venv/local/lib/python2.7/site-packages/sorl/thumbnail/engines/base.py", line 53, in colorspace
    return self._colorspace(image, colorspace)
  File "/data/www/housemgr/venv/local/lib/python2.7/site-packages/sorl/thumbnail/engines/pil_engine.py", line 101, in _colorspace
    return image.convert('RGB')
  File "/data/www/housemgr/venv/local/lib/python2.7/site-packages/PIL/Image.py", line 832, in convert
    self.load()
  File "/data/www/housemgr/venv/local/lib/python2.7/site-packages/PIL/ImageFile.py", line 200, in load
    d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "/data/www/housemgr/venv/local/lib/python2.7/site-packages/PIL/Image.py", line 417, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available

Missing lib.... I spent three hours and get this... I should have checked app.log at first. How idiot am I....

But I still can not solve this problem, http://stackoverflow.com/questions/8915296/python-image-library-fails-with-message-decoder-jpeg-not-available-pil not work...