Re: Resize images on demand

2007-05-20 Thread SmileyChris
If any committer wants to look at it, I consider this patch feature- complete (and has some unit tests now) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send emai

Re: Resize images on demand

2007-05-17 Thread [EMAIL PROTECTED]
Cool. I attached a simple patch that shows how I ended up solving the "size" problem. I just realized there's a small bug in my cut & paste but you can get the idea. size_cache.set(self.filename, im.size, _SIZE_CACHE_TIMEOUT) should be size_cache.set(self.filename, img.size, _SIZE_CACHE_TI

Re: Resize images on demand

2007-05-17 Thread SmileyChris
Right, check out the ticket again - new patch up. http://code.djangoproject.com/ticket/4115 On May 17, 1:19 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > The most common use case is that someone wants to create the tag > with the appropriate height and width. If the incorrect values are

Re: Resize images on demand

2007-05-16 Thread [EMAIL PROTECTED]
The most common use case is that someone wants to create the tag with the appropriate height and width. If the incorrect values are put in, then the browser might try to scale the image which is not what we want. I'm not opposed to modifying the tag to return the actual size by using PIL calls.

Re: Resize images on demand

2007-05-16 Thread Chris Beaven
Hi John, Probably the best thing to do is look at the contrib.thumbnails patch and see if there's something you could add to it: http://code.djangoproject.com/ticket/4115 On 5/16/07, John Sutherland <[EMAIL PROTECTED]> wrote: > > Morning, > > Sorry, I'm a little late to join this discussion. > >

Re: Resize images on demand

2007-05-16 Thread John Sutherland
Morning, Sorry, I'm a little late to join this discussion. We have some code here (at Mercurytide[1]) which we use to generate thumbnails by cropping and scaling images, results can be seen on the bottom of the right column of: I'll see what the

Re: Resize images on demand

2007-05-16 Thread Chris Beaven
On 5/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > The other alternative might be to cache the file sizes and return it > that way. The benfit is that the filenames are cleaner but the > downside might be the complexity. Or we just keep it the way it is ;) Is there really that much bene

Re: Resize images on demand

2007-05-15 Thread [EMAIL PROTECTED]
You raise good points about the overhead of computing size of the file. My solution would have involved adding another property of the object that would read the image and return the size. Probably very very inefficient. Maybe the filename needs to encode the actual size as well as the specified

Re: Resize images on demand

2007-05-15 Thread Chris Beaven
Hrm... I can see how the name could be a bit confusing, but the reasoning is that that IS what the thumbnail was created with and that's how it decides whether there is a thumbnail for it or not. If you were to call it "240x192" then we wouldn't know that there was an existing cached thumbnail un

Re: Resize images on demand

2007-05-15 Thread [EMAIL PROTECTED]
Chris, I've been working on adding unit tests for this patch and hit a little snag regarding the way the "size" is returned. Say I have an image that is 640x512 and I create a thumbnail passing in "240x240". The resulting thumbnail is scaled down to "240x192". Which causes some confusing naming

Re: Resize images on demand

2007-04-23 Thread [EMAIL PROTECTED]
Fair enough. I think we've beaten this one to death and the current solution works fine for me (with the additional minor tweaks we've already mentioned). Thanks, Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

Re: Resize images on demand

2007-04-23 Thread Chris Beaven
On 4/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > In other words, I want the width to always be 75 but the height can > vary based on the specifics of the image. Does this make sense? If > this is what I'd like to do, how would I do it with the tag as it > stands now? Well without spec

Re: Resize images on demand

2007-04-23 Thread Michel Thadeu Sabchuk
Hi guys! I test your application and enjoy it SmileyChris, there is just a bug :), contrib/thumbnails/templatestags/__init__.py is missing, a "touch __init__.py" solves the problem ;) I like the way you return a Thumbnail object reather than just the string. Congratulations, very thanks to you!

Re: Resize images on demand

2007-04-23 Thread [EMAIL PROTECTED]
Ok, I think I'm understanding the distinction in your terminology. I definitely don't want an image that 75x10,000. Here's my scenario: Original Image 1 = 750 X 100, I would only like to specify that the new image was 75 wide and let it figure out that the new height should be 10 (preserve asp

Re: Resize images on demand

2007-04-22 Thread Chris Beaven
On 4/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I downloaded the patch and got it to work. I have a couple of > observations based on usage. > > - If we continue to use the format "150x200" to specify the size, we > may want to do a string.lower() on the input. I originally had a >

Re: Resize images on demand

2007-04-22 Thread [EMAIL PROTECTED]
I downloaded the patch and got it to work. I have a couple of observations based on usage. - If we continue to use the format "150x200" to specify the size, we may want to do a string.lower() on the input. I originally had a capital X and couldn't figure out what the problem was. Yeah, it's a

Re: Resize images on demand

2007-04-22 Thread SmileyChris
On Apr 23, 9:25 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > This is a really great patch. I read the patch but have not attempted > to use yet. Here are a couple of thoughts: > - I think the patch file itself may be a little messed up. I see that > several of the files are repeated. I

Re: Resize images on demand

2007-04-22 Thread [EMAIL PROTECTED]
This is a really great patch. I read the patch but have not attempted to use yet. Here are a couple of thoughts: - I think the patch file itself may be a little messed up. I see that several of the files are repeated. I could just be reading it wrong. - Big positive in that you documented it s

Re: Resize images on demand

2007-04-22 Thread SmileyChris
I put together my take on django.contib.thumbnails and posted it as a patch http://code.djangoproject.com/ticket/4115 Please read through the documentation and give some feedback. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

Re: Resize images on demand

2007-04-20 Thread [EMAIL PROTECTED]
I've started a page to discuss the different options here. http://code.djangoproject.com/wiki/ThumbNails -Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, sen

Re: Resize images on demand

2007-04-19 Thread Brett Parker
On Wed, Apr 18, 2007 at 08:28:00PM -0500, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > On 4/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Would you consider adding a thumbnail capability to Django? I know > > there are contributions out there that do it and the dependency on PIL >

Re: Resize images on demand

2007-04-19 Thread Michel Thadeu Sabchuk
Hi guys, On the user list I found a more complete solution: http://code.google.com/p/django-utils/wiki/Thumbnail Maybe this could be add as a contrib package? Best regards! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Resize images on demand

2007-04-19 Thread Michel Thadeu Sabchuk
Hi Jacob, how are you? > I'd be +1 on adding something as a contrib app. I've got some code we > use at work, but it'll likely be some time before I'm able to > generalize it enough for public consumption, so I'd be thrilled to see > an effort by a few committed community members... I done some

Re: Resize images on demand

2007-04-18 Thread Jacob Kaplan-Moss
On 4/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Would you consider adding a thumbnail capability to Django? I know > there are contributions out there that do it and the dependency on PIL > might be a negative but I believe this is a very common use case. How > many apps have an image

Re: Resize images on demand

2007-04-18 Thread [EMAIL PROTECTED]
Just a question out to the developers- Would you consider adding a thumbnail capability to Django? I know there are contributions out there that do it and the dependency on PIL might be a negative but I believe this is a very common use case. How many apps have an image field and don't use some

Re: Resize images on demand

2007-04-18 Thread Michel Thadeu Sabchuk
Hi Ok, sorry about that Jacob! Thanks for pointing me at right place! Best Regards, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers

Re: Resize images on demand

2007-04-17 Thread Jacob Kaplan-Moss
Hey Michel -- Please direct questions of this nature to django-users; django-dev is used to discuss the development of Django itself, not to answer usage questions. Thanks! Jacob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

Resize images on demand

2007-04-17 Thread Michel Thadeu Sabchuk
Hi guys! I done a cool functionality to my site, the possibility to resize images on demand. It's not 100% done yet but my goal is to do something like: ... class Article(models.Model): photo = models.ImageField(upload_to='some/path/some/where') def get_pho