Issue with uploading profile image, cover
  • Hello,

    I can't upload any picture on booktype.
    I get this after uploading and refreshing

    www-data owns booktype/data folder and rights on folders are 775
    in booktype/data/profile_images there is my picture seng.jpg but 0ko

    I don't get what I'm missing.

    Regards.
  • 7 Comments sorted by
  • Hard to say. Either you don't have installed Python Image Library or PIL can't read that specific image. Can you just paste "http://booktype.local/_utils/profilethumb/seng/thumbnail.jpg?width=48" in your browser and see what kind of error do you get. You must have DEBUG=True in your settings.py for this to work.
  • Ok thanks !

    IOError at /_utils/profilethumb/seng/thumbnail.jpg
    decoder jpeg not available
    Request Method: GET
    Request URL: http://booktype.local/_utils/profilethumb/seng/thumbnail.jpg?width=48
    Django Version: 1.3.1
    Exception Type: IOError
    Exception Value:
    decoder jpeg not available
    Exception Location: /usr/local/lib/python2.7/dist-packages/PIL-1.1.7-py2.7-linux-x86_64.egg/Image.py in _getdecoder, line 385
    Python Executable: /usr/bin/python
    Python Version: 2.7.3
    Python Path:
    ['/var/www/',
    '/var/www/booktype/lib/',
    '/home/seng/www/Booktype/lib/',
    '/usr/local/lib/python2.7/dist-packages/South-0.7.5-py2.7.egg',
    '/usr/local/lib/python2.7/dist-packages/lxml-2.3.4-py2.7-linux-x86_64.egg',
    '/usr/local/lib/python2.7/dist-packages/PIL-1.1.7-py2.7-linux-x86_64.egg',
    '/usr/local/lib/python2.7/dist-packages/wkhtmltopdf-0.2-py2.7.egg',
    '/usr/lib/python2.7',
    '/usr/lib/python2.7/plat-linux2',
    '/usr/lib/python2.7/lib-tk',
    '/usr/lib/python2.7/lib-old',
    '/usr/lib/python2.7/lib-dynload',
    '/usr/local/lib/python2.7/dist-packages',
    '/usr/lib/python2.7/dist-packages']
    Server time: Thu, 5 Jul 2012 09:37:04 +0200

    So I tried reinstall PIL with pip, then I saw that 


      PIL 1.1.7 SETUP SUMMARY
        --------------------------------------------------------------------
        version       1.1.7
        platform      linux2 2.7.3 (default, Apr 20 2012, 22:39:59)
                      [GCC 4.6.3]
        --------------------------------------------------------------------
        *** TKINTER support not available
        *** JPEG support not available
        *** ZLIB (PNG/ZIP) support not available
        *** FREETYPE2 support not available
        *** LITTLECMS support not available


    I have libjpeg, libz and libfreetype, I tried some trick like creating symbolic link to /usr/lib since they were installed in x86_64-linux-gnu but after reinstalling there is still no support for them.


    I tried setting a picture (png, error for others : "Upload a valid image. The file you uploaded was either not an image or a corrupted image") for a user from the admin section, it works. Why wouldn't it work with the frontend...


    Ok I solved it, my symbolic link weren't good they were pointing to themselves...

    Thanks for the help :)
    Post edited by Vibol Seng at 2012-07-05 07:31:07
  • I have the same issue, Pictures are showing fine, however thumbnails and previews are not.

    The first error was: encoder zip not available.
    This however looks to be solved (not sure how i managed)

    The new error is: encoder jpeg not showing.
    - I installed all the needed libs and dev's (and many extra just in case)
    - I forced PIL uninstall-install
    - And i created the symlincs

    Not sure what to do anymore, so any help would be appriciated, here is my current error:

    IOError at /_utils/profilethumb/kamaradski/thumbnail.jpg

    encoder jpeg not available
    Request Method:GET
    Request URL:http://kamaradski.no-ip.org:85/_utils/profilethumb/kamaradski/thumbnail.jpg?width=48
    Django Version:1.3
    Exception Type:IOError
    Exception Value:
    encoder jpeg not available
    Exception Location:/var/www/mybooktype/lib/python2.7/site-packages/PIL/Image.py in _getencoder, line 401
    Python Executable:/usr/bin/python
    Python Version:2.7.3
    Python Path:
    ['/var/www/mybooktype/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg',
    '/var/www/mybooktype/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
    '/var/www/mybooktype/lib/python2.7/site-packages',
    '/var/www/mybooktype/lib/python2.7/site-packages/PIL',
    '/var/www/mybooktype/',
    '/var/www/mybooktype/mybook/lib/',
    '/var/www/mybooktype/Booktype/lib/',
    '/usr/lib/python2.7',
    '/usr/lib/python2.7/plat-linux2',
    '/usr/lib/python2.7/lib-tk',
    '/usr/lib/python2.7/lib-old',
    '/usr/lib/python2.7/lib-dynload',
    '/usr/local/lib/python2.7/dist-packages',
    '/usr/lib/python2.7/dist-packages',
    '/usr/lib/pymodules/python2.7']
    Server time:Mon, 11 Nov 2013 08:11:19 +0100
  • Hi!

    What OS do you have? Looking at the error message I would say you are missing JPEG encoder for your PIL/Pillow installation. You can see here: https://wiki.sourcefabric.org/display/Booktype/How+to+install+it+on+Ubuntu which libraries you would need to install PNG and JPEG support. If you have installed them already the problem might be somewhere else then.

    Aco
  • Thanks Aleksander,

    I was giving it a go with Turnkey and kubuntu, both no luck even when very sure the correct libs where installed. running at least 6 times through the install instructions from scratch and searching online for solutions.

    I dont have time to loose more then 2 full days on installation, so i went ahead and got pro, saves me the trouble :) Thanks anyway for your advice!
  • Seems like the PIL that comes with Booktype doesn't have all of the dependencies it needs so it cannot handle the images.

    I got it to work by just installing PIL with working dependencies and using that instead of Booktype's PIL, but you need sudo rights for this. You can Google for PIL installation instructions for your system.

    Then you can remove ~/mybooktype/local/lib/python2.7/site-packages/PIL and create a symlink ~/mybooktype/local/lib/python2.7/site-packages/PIL to /usr/local/lib/python2.7/dist-packages/PIL/

  • Booktype does not come with special version of PIL. Booktype creates isolated virtual environment for this project and installs packages locally (PIL included).

    If required libraries are not installed on the system any kind of PIL will not have support for specific libraries. To fix this issue you need to install required system libraries and then install PIL again in the virtual environment.

    Install script from Booktype-Scrolls project for instance checks system libraries for different OS and installs required requirements - https://github.com/aerkalov/booktype-scrolls/tree/master/scripts/install