Calling get_serving_url only once per blob is definitely the recommended approach.
On Thursday, 24 January 2013 23:53:24 UTC+11, alex wrote: > > Hey Renzo, > > there's even a simpler approach: > > url = images.get_serving_url(instance.blob) > > resized_64 = url + '=s64' > resized_128_crop = url + '=s128-c' > > That way you're calling get_serving_url only once, so it should be even > faster. > I think the '=size' thing is described somewhere in the Images API docs. > > On Thu, Jan 24, 2013 at 1:43 PM, Renzo Nuccitelli > <ren...@gmail.com<javascript:>> > wrote: > > The images are hosted in GAE's Blobstore? If it is, the best way is > using > > images API (https://developers.google.com/appengine/docs/python/images/). > > > > > The only problem with that i found when using it was that some times it > > take a lot of time to generating a url from a resized image. So I just > > stoped to generate the transformed image when the user make the request > and > > started to generate the link just before saving my model on extra fields > of > > it. This is working very well for me now. Here is a sample were I create > an > > avatar and make 5 different image sizes: > > > > _SIZE_1=24 > > _SIZE_2=36 > > _SIZE_3=64 > > _SIZE_4=88 > > _SIZE_BIG=260 > > > > _PIC_DEFAULTS={_SIZE_1:"/static/img/default-photo-1.png",\ > > _SIZE_2:"/static/img/default-photo-2.png",\ > > _SIZE_3:"/static/img/default-photo-3.png",\ > > _SIZE_4:"/static/img/default-photo-4.png",\ > > _SIZE_BIG:"/static/img/default-photo-big.png"} > > def _resize(size): > > def resize(instance): > > if instance.blob: > > return images.get_serving_url(instance.blob,size) > > return _PIC_DEFAULTS[size] > > return resize > > > > #Class holding User Pictures > > class Avatar(ndb.Model,UserChild): > > blob=ndb.BlobKeyProperty() > > pic1=ndb.ComputedProperty(_resize(_SIZE_1),indexed=False) > > pic2=ndb.ComputedProperty(_resize(_SIZE_2),indexed=False) > > pic3=ndb.ComputedProperty(_resize(_SIZE_3),indexed=False) > > pic4=ndb.ComputedProperty(_resize(_SIZE_4),indexed=False) > > picBig=ndb.ComputedProperty(_resize(_SIZE_BIG),indexed=False) > > > > I Wrote this code when there were not asyncronous API for images, so it > can > > be improved using this new API. > > > > I hope it helps you, > > > > Renzo Nuccitelli > > > > Quarta-feira, 23 de Janeiro de 2013 12:34:54 UTC-2, Bhavya Sravani > escreveu: > >> > >> > >> Hi > >> > >> Could anyone please help me with my query ?? > >> > >> I am actually working on a project in which I have many images in a > server > >> and need to tile the images based upon the response . . > >> > >> I actually want to know what would be fastest method of tilling . . Any > >> information or suggestions regarding the same ? > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Google App Engine" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/google-appengine/-/oLDXM6VyDNoJ. > > To post to this group, send email to > > google-a...@googlegroups.com<javascript:>. > > > To unsubscribe from this group, send email to > > google-appengi...@googlegroups.com <javascript:>. > > For more options, visit this group at > > http://groups.google.com/group/google-appengine?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/wSZUYDd1gmMJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.