On Friday, September 7, 2012 11:22:41 AM UTC-4, BlueShadow wrote:
I tried your solution and it just leaves the thumb field empty and no
thumbnail is created in the upload folder.
Are you referring to Paolo's solution or this one:
thisImage.update_record(thumb=db.Images.thumb.store(im,
I was referring to paolos post
On Friday, September 7, 2012 5:38:15 PM UTC+2, Anthony wrote:
On Friday, September 7, 2012 11:22:41 AM UTC-4, BlueShadow wrote:
I tried your solution and it just leaves the thumb field empty and no
thumbnail is created in the upload folder.
Are you
Yes, I see a message was deleted -- don't know who deleted it. Can you post
the error again?
On Friday, September 7, 2012 11:41:05 AM UTC-4, BlueShadow wrote:
I was referring to paolos post
your solution gives me just the error message I don't understand Anthony.
I posted the error message
Traceback (most recent call last):
File F:\Website\web2py\gluon\restricted.py, line 209, in restricted
exec ccode in environment
File F:/Website/web2py/applications/testthumb/controllers/default.py
http://127.0.0.1:8000/admin/default/edit/testthumb/controllers/default.py,
line 128, in
How about if you do something like:
from cStringIO import StringIO
tmp = StringIO()
im.save(tmp, 'jpeg')
tmp.seek(0)
thisImage.update_record(thumb=db.Images.thumb.store(tmp, filename=
'thumbnail.jpg'))
Anthony
On Friday, September 7, 2012 12:07:27 PM UTC-4, BlueShadow wrote:
Traceback (most
cStringIO.StringIO is a file-like object. The code saves the thumbnail to
that object and then passes it to the .store() method, which treats it like
an actual file.
Anthony
On Friday, September 7, 2012 4:24:46 PM UTC-4, BlueShadow wrote:
Anthony you are the best. I got pretty much no Idea
Did you try this
method: https://groups.google.com/d/msg/web2py/tgZRofX0RgY/rHMBUkYws1wJ
On Thursday, September 6, 2012 1:19:06 PM UTC-4, BlueShadow wrote:
So I made an application containing just pa page to upload the image, make
an article and display the article.
It shows the original
the link directs to this group Anthony.
I didn't try:
thisImage.update_record(thumb=db.Images.thumb.store(im, filename=
'thumbnail.jpg'))
this would store the thumb directly in the database?
On Thursday, September 6, 2012 9:53:22 PM UTC+2, Anthony wrote:
Did you try this method:
On Thursday, September 6, 2012 4:23:50 PM UTC-4, BlueShadow wrote:
the link directs to this group Anthony.
Yes, I know, but I noticed you're code didn't implement that solution so
was wondering if you had tried it.
I didn't try:
thisImage.update_record(thumb=db.Images.thumb.store(im,
So I changed it to this:
def makeThumbnail(dbtable,ImageID,size=(200,200)):
try:
thisImage=db(dbtable.id==ImageID).select()[0]
import os, uuid
except:
print Error while loading libraries
return
try:
from PIL import Image
except:
def Article():
id=request.vars.id
row=db(db.Article.id==id).select()
Not sure how you get the Images filenames. The code does not seem join the
Article to the Image?
Maybe something like:
def Article():
id=request.vars.id # -- only ok for testing
the image filename is joined to articles by this line:
Field('TopImage',db.Images)
id=request.vars.id #-- only ok for testing
I removed some code to make it as short as possible the original version
gets the article id from request.vars.id
if none is given it redirects to a page where you can
On Wednesday, September 5, 2012 10:07:29 AM UTC-4, villas wrote:
def Article():
id=request.vars.id
row=db(db.Article.id==id).select()
Not sure how you get the Images filenames. The code does not seem join
the Article to the Image?
Note, Article.TopImage.thumb does a recursive
thumbName='uploads.thumb.%s.jpg' % (uuid.uuid4())
im.save(request.folder + 'uploads/' + thumbName,'jpeg')
The above is not quite the naming scheme expected by response.download.
Instead of trying to make the name yourself, it might be easier to use the
field's .store() method to
14 matches
Mail list logo