Cannot upload an image file from my Admin Interface

11 views
Skip to first unread message

Anurag

unread,
Sep 13, 2012, 11:04:01 PM9/13/12
to satchm...@googlegroups.com

  Hi,
     I am trying to create categories and products on my satchmo site and when i try to upload an image (jpg/png or whatever), i get the following error.

              "Upload a valid image. The file you uploaded was either not an image or a corrupted image".

    The images open fine on GIMP. I am running linux.

    I re-installed my PIL(after removing the PIL directory and the PIL.pth file), but that did not change anything.

    I have seen some threads talking about this error, and the only thing i could understand that i could try was to change the PIL installation.

   Any other ideas. thanks
Anurag


Olivier Lauret

unread,
Sep 14, 2012, 9:41:12 AM9/14/12
to satchm...@googlegroups.com
Hi Anurag,

The problem is probably not related to PIL as, if I'm not wrong, uploading the image just change its name (by default) and put it in the relevant folder. PIL is used when you use the thumbnail functionality. I'm using Linux as well and I don't have any issue. Have you check the permission on the static/images folder and the user used when running the django project?

Regards,
Olivier


Anurag


--
You received this message because you are subscribed to the Google Groups "Satchmo users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/satchmo-users/-/focr65S2fREJ.
To post to this group, send email to satchm...@googlegroups.com.
To unsubscribe from this group, send email to satchmo-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en.



--
Equalitea_logo

Jesaja Everling

unread,
Sep 14, 2012, 9:59:37 AM9/14/12
to satchm...@googlegroups.com
PS.:

If you have libjpeg-dev and libpng-dev, maybe PIL just can't find the libraries:

http://jj.isgeek.net/2011/09/install-pil-with-jpeg-support-on-ubuntu-oneiric-64bits/

In this case, it will print something like this after compiling the module:

    *** TKINTER support not available (Tcl/Tk 8.5 libraries needed)
    *** JPEG support not available
    *** ZLIB (PNG/ZIP) support not available
    *** FREETYPE2 support not available
    *** LITTLECMS support not available


Best Regards,

Jesaja Everling


On Fri, Sep 14, 2012 at 3:52 PM, Jesaja Everling <jeve...@gmail.com> wrote:
Hi Olivier,
Hi Anurag,

in fact, PIL is also used to verify if the file that was uploaded is a valid image when ImageField is used.
So the problem may in fact be due to PIL.

@Anurag: Make sure to have libjpeg-dev and libpng-dev installed, then try to install PIL again using "pip install PIL --upgrade" (or removing and re-installing it).
Maybe PIL can't compile the code necessary to open these image formats (it should print that somewhere when compiling the module).

Best Regards,

Jesaja Everling

Jesaja Everling

unread,
Sep 14, 2012, 9:52:54 AM9/14/12
to satchm...@googlegroups.com
Hi Olivier,
Hi Anurag,

in fact, PIL is also used to verify if the file that was uploaded is a valid image when ImageField is used.
So the problem may in fact be due to PIL.

@Anurag: Make sure to have libjpeg-dev and libpng-dev installed, then try to install PIL again using "pip install PIL --upgrade" (or removing and re-installing it).
Maybe PIL can't compile the code necessary to open these image formats (it should print that somewhere when compiling the module).

Best Regards,

Jesaja Everling


On Fri, Sep 14, 2012 at 3:41 PM, Olivier Lauret <olivier...@googlemail.com> wrote:

Anurag

unread,
Sep 15, 2012, 3:42:06 AM9/15/12
to satchm...@googlegroups.com
I did compile (re-compile PIL) based on instructions on blogs  and now when i run the tests they all pass and this is what i see

PIL 1.1.7 TEST SUMMARY
--------------------------------------------------------------------
Python modules loaded from ./PIL
Binary modules loaded from ./PIL
--------------------------------------------------------------------
--- PIL CORE support ok
--- TKINTER support ok
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok
--- LITTLECMS support ok
--------------------------------------------------------------------
Running selftest:
--- 57 tests passed.


What should be the permission status on the static/images area?
Thanks Olliver,Jesaja
Anurag

Anurag

unread,
Sep 15, 2012, 3:50:04 AM9/15/12
to satchm...@googlegroups.com
It seems like the files are being created , however they are 0 bytes in size. Seems like the process is not writing the file after it opens it.
It is seemingly like a permissions problem, but unable to figure it out.

The permissions on  the static/images directory is "rwxrwxr_x".
Reply all
Reply to author
Forward
0 new messages