[web2py] Re: Can't retrieve xy.jpeg file properties (.thumbnail vs .jpeg) from PIL resized image (2.6.0-dev)

2013-08-28 Thread Adi
Thanks Ricardo and Niphlod for your help!


On Tuesday, August 27, 2013 5:59:44 PM UTC-4, Niphlod wrote:

 you kinda have to. contenttype is automatically guessed from the extension 
 only. There's no header instrospection.

 On Tuesday, August 27, 2013 9:07:56 PM UTC+2, Adi wrote:


 This is the example I used for resizing images: 
 http://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio,
  
 and the one with extension .thumbnail works fine, but jpeg doesn't. I 
 didn't set the content-type manually. 
  

 On Tuesday, August 27, 2013 2:39:03 PM UTC-4, Niphlod wrote:

 your thmbnail doesn't have an extension: do you set the content-type 
 manually ?



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Can't retrieve xy.jpeg file properties (.thumbnail vs .jpeg) from PIL resized image (2.6.0-dev)

2013-08-27 Thread Niphlod
your thmbnail doesn't have an extension: do you set the content-type 
manually ?

On Tuesday, August 27, 2013 6:22:17 PM UTC+2, Adi wrote:


 Used the Python Imaging Library (with JPEG decoder) to create set of 
 thumbnails. For the images with jpeg extension, the error pops up that the 
 properties can't be retrieved, while for the non-image extensions, 
 everything displays fine. 

 Is this a problem with PIL not generating enough header information about 
 the image, or something else? Size-wise, .thumbnail is 4x smaller, but the 
 quality is really low. The original JPG displays fine too... 

 thumbnails resizing: 
 ...
 im = Image.open(infile)
 im.thumbnail(size)
 im.save(outfile, JPEG)



 displaying images:
 {{
 img1 = 
 'product.image.85d32040405f61e9.626c61636b2d6e616d6d752e6a7067.thumbnail180x160'
 img2 = 
 'product.image.85d32040405f61e9.626c61636b2d6e616d6d752e6a7067.180x160.jpeg'
 }}

 !--img src={{#=URL('download', args=img1, scheme=True, host=True)}}--
 img src={{=URL('download', args=img2, scheme=True, host=True)}}



 Traceback (most recent call last):
  
  File /Users/adnan/web2py26/gluon/restricted.py, line 217, in restricted
 exec ccode in environment
   File /Users/adnan/web2py26/applications/nammu/controllers/default.py,line 
 2983, in module
 
   File /Users/adnan/web2py26/gluon/globals.py, line 361, in lambda
 self._caller = lambda f: f()
   File /Users/adnan/web2py26/applications/nammu/controllers/default.py,line 
 2105, in download
 return response.download(request, db)
   File /Users/adnan/web2py26/gluon/globals.py, line 574, in download
 (filename, stream) = field.retrieve(name,nameonly=True)
   File /Users/adnan/web2py26/gluon/dal.py, line 9558, in retrieve
 file_properties = self.retrieve_file_properties(name,path)
   File /Users/adnan/web2py26/gluon/dal.py, line 9583, 
 inretrieve_file_properties
 raise TypeError('Can\'t retrieve %s file properties' % name)
 TypeError: Can't retrieve 
 product.image.85d32040405f61e9.626c61636b2d6e616d6d752e6a7067.180x160.jpeg 
 file properties






-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Can't retrieve xy.jpeg file properties (.thumbnail vs .jpeg) from PIL resized image (2.6.0-dev)

2013-08-27 Thread Adi

This is the example I used for resizing images: 
http://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio,
 
and the one with extension .thumbnail works fine, but jpeg doesn't. I 
didn't set the content-type manually. 
 

On Tuesday, August 27, 2013 2:39:03 PM UTC-4, Niphlod wrote:

 your thmbnail doesn't have an extension: do you set the content-type 
 manually ?



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Can't retrieve xy.jpeg file properties (.thumbnail vs .jpeg) from PIL resized image (2.6.0-dev)

2013-08-27 Thread Niphlod
you kinda have to. contenttype is automatically guessed from the extension 
only. There's no header instrospection.

On Tuesday, August 27, 2013 9:07:56 PM UTC+2, Adi wrote:


 This is the example I used for resizing images: 
 http://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio,
  
 and the one with extension .thumbnail works fine, but jpeg doesn't. I 
 didn't set the content-type manually. 
  

 On Tuesday, August 27, 2013 2:39:03 PM UTC-4, Niphlod wrote:

 your thmbnail doesn't have an extension: do you set the content-type 
 manually ?



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.