<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Django Thumbnails</title>
	<atom:link href="http://tomcoote.co.uk/code-bank/django-thumbnails/feed/" rel="self" type="application/rss+xml" />
	<link>http://tomcoote.co.uk</link>
	<description>An ace web developer!</description>
	<lastBuildDate>Tue, 31 Jan 2012 19:47:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tom Coote</title>
		<link>http://tomcoote.co.uk/code-bank/django-thumbnails/comment-page-1/#comment-30781</link>
		<dc:creator>Tom Coote</dc:creator>
		<pubDate>Wed, 30 Nov 2011 13:15:42 +0000</pubDate>
		<guid isPermaLink="false">http://cootetom.co.uk/?page_id=28#comment-30781</guid>
		<description>You can call save on the field to store the file to disk without saving the model instance. The model instance get&#039;s saved via calling super at the end so I&#039;d place this logic at the top of the function but after the noResizing if statement block...

if not self.photo.size:
    self.photo.save(self.photo.name, self.photo, save=False)

I&#039;ve not tested this but I think size will only be present if the file exists in storage. Then calling save on the photo attribute will save it to disk but because you&#039;ve given it the key word argument save=False then it doesn&#039;t actually save the model instance because we do that later anyway.</description>
		<content:encoded><![CDATA[<p>You can call save on the field to store the file to disk without saving the model instance. The model instance get&#8217;s saved via calling super at the end so I&#8217;d place this logic at the top of the function but after the noResizing if statement block&#8230;</p>
<p>if not self.photo.size:<br />
    self.photo.save(self.photo.name, self.photo, save=False)</p>
<p>I&#8217;ve not tested this but I think size will only be present if the file exists in storage. Then calling save on the photo attribute will save it to disk but because you&#8217;ve given it the key word argument save=False then it doesn&#8217;t actually save the model instance because we do that later anyway.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: el</title>
		<link>http://tomcoote.co.uk/code-bank/django-thumbnails/comment-page-1/#comment-30777</link>
		<dc:creator>el</dc:creator>
		<pubDate>Wed, 30 Nov 2011 12:54:29 +0000</pubDate>
		<guid isPermaLink="false">http://cootetom.co.uk/?page_id=28#comment-30777</guid>
		<description>Do u have maybe some suggestions for resolve this problem? How to save this file or get path from field before save?</description>
		<content:encoded><![CDATA[<p>Do u have maybe some suggestions for resolve this problem? How to save this file or get path from field before save?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Coote</title>
		<link>http://tomcoote.co.uk/code-bank/django-thumbnails/comment-page-1/#comment-30774</link>
		<dc:creator>Tom Coote</dc:creator>
		<pubDate>Wed, 30 Nov 2011 12:46:14 +0000</pubDate>
		<guid isPermaLink="false">http://cootetom.co.uk/?page_id=28#comment-30774</guid>
		<description>Ah right I see. A bit of a flaw in the logic there. I guess I must have always been using this on an image that is already saved to disk.</description>
		<content:encoded><![CDATA[<p>Ah right I see. A bit of a flaw in the logic there. I guess I must have always been using this on an image that is already saved to disk.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: el</title>
		<link>http://tomcoote.co.uk/code-bank/django-thumbnails/comment-page-1/#comment-30773</link>
		<dc:creator>el</dc:creator>
		<pubDate>Wed, 30 Nov 2011 12:20:32 +0000</pubDate>
		<guid isPermaLink="false">http://cootetom.co.uk/?page_id=28#comment-30773</guid>
		<description>Sory of comment under comment , but I forget:

Only if I will write before line imgFile = Image.open(self.photo.path):

self.photo.save(self.photo.name,self.photo,save=True)

then I can open file with Image.open(self.photo.path)</description>
		<content:encoded><![CDATA[<p>Sory of comment under comment , but I forget:</p>
<p>Only if I will write before line imgFile = Image.open(self.photo.path):</p>
<p>self.photo.save(self.photo.name,self.photo,save=True)</p>
<p>then I can open file with Image.open(self.photo.path)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: el</title>
		<link>http://tomcoote.co.uk/code-bank/django-thumbnails/comment-page-1/#comment-30772</link>
		<dc:creator>el</dc:creator>
		<pubDate>Wed, 30 Nov 2011 12:18:28 +0000</pubDate>
		<guid isPermaLink="false">http://cootetom.co.uk/?page_id=28#comment-30772</guid>
		<description>I have coppied this code, and run, then I have error in line:

imgFile = Image.open(self.photo.path) , because :

    def save(self, area=CROP_SIZE, crop=False, noResizing=False):

        if noResizing:
            super(Example, self).save()
            return

here we have no Resizing=False, so &#039;if&#039; block will not execute his body it&#039;s ok, but the rest part of code will be, and in line:

imgFile = Image.open(self.photo.path) 

django says: I cannot open Image that doesn&#039;t exist on path : self.photo.path . Why? Because it is not saved.</description>
		<content:encoded><![CDATA[<p>I have coppied this code, and run, then I have error in line:</p>
<p>imgFile = Image.open(self.photo.path) , because :</p>
<p>    def save(self, area=CROP_SIZE, crop=False, noResizing=False):</p>
<p>        if noResizing:<br />
            super(Example, self).save()<br />
            return</p>
<p>here we have no Resizing=False, so &#8216;if&#8217; block will not execute his body it&#8217;s ok, but the rest part of code will be, and in line:</p>
<p>imgFile = Image.open(self.photo.path) </p>
<p>django says: I cannot open Image that doesn&#8217;t exist on path : self.photo.path . Why? Because it is not saved.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Coote</title>
		<link>http://tomcoote.co.uk/code-bank/django-thumbnails/comment-page-1/#comment-30769</link>
		<dc:creator>Tom Coote</dc:creator>
		<pubDate>Wed, 30 Nov 2011 12:02:25 +0000</pubDate>
		<guid isPermaLink="false">http://cootetom.co.uk/?page_id=28#comment-30769</guid>
		<description>If noResizing=False then it doesn&#039;t try and manipulate the image so it doesn&#039;t matter if it doesn&#039;t exist. That key word argument is there to allow you to save without doing any custom image manipulation.</description>
		<content:encoded><![CDATA[<p>If noResizing=False then it doesn&#8217;t try and manipulate the image so it doesn&#8217;t matter if it doesn&#8217;t exist. That key word argument is there to allow you to save without doing any custom image manipulation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: el</title>
		<link>http://tomcoote.co.uk/code-bank/django-thumbnails/comment-page-1/#comment-30768</link>
		<dc:creator>el</dc:creator>
		<pubDate>Wed, 30 Nov 2011 11:55:59 +0000</pubDate>
		<guid isPermaLink="false">http://cootetom.co.uk/?page_id=28#comment-30768</guid>
		<description>It doesn&#039;t work, because when you have noResizing=False, then photo is not saved and in line:

imgFile = Image.open(self.photo.path)

u have Image that doesn&#039;t exist :&#124;</description>
		<content:encoded><![CDATA[<p>It doesn&#8217;t work, because when you have noResizing=False, then photo is not saved and in line:</p>
<p>imgFile = Image.open(self.photo.path)</p>
<p>u have Image that doesn&#8217;t exist <img src='http://tomcoote.co.uk/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arthur</title>
		<link>http://tomcoote.co.uk/code-bank/django-thumbnails/comment-page-1/#comment-20635</link>
		<dc:creator>Arthur</dc:creator>
		<pubDate>Fri, 19 Aug 2011 15:01:17 +0000</pubDate>
		<guid isPermaLink="false">http://cootetom.co.uk/?page_id=28#comment-20635</guid>
		<description>Good stuff! now will test using S3 storage, but it seems that all is going to work fine! thanks!</description>
		<content:encoded><![CDATA[<p>Good stuff! now will test using S3 storage, but it seems that all is going to work fine! thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Manastirliu</title>
		<link>http://tomcoote.co.uk/code-bank/django-thumbnails/comment-page-1/#comment-5629</link>
		<dc:creator>Stefan Manastirliu</dc:creator>
		<pubDate>Mon, 24 Jan 2011 11:47:59 +0000</pubDate>
		<guid isPermaLink="false">http://cootetom.co.uk/?page_id=28#comment-5629</guid>
		<description>This is exactly what i was looking for! Thanks for sharing it!</description>
		<content:encoded><![CDATA[<p>This is exactly what i was looking for! Thanks for sharing it!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

