djangosnippets.org: Latest snippets tagged with 'resize'http://djangosnippets.org/tags/resize/2016-12-29T10:30:09.721190-06:00Resize or Modify an image before saving
2016-12-29T10:30:09.721190-06:00asurahttp://djangosnippets.org/snippets/10597/<p>Small snippet that will resize all images before they uploaded to the server. </p>
Freely redistributableSignal to resize uploaded Fiber images as new thumbnailed images
2012-02-13T18:45:06.854535-06:00versaehttp://djangosnippets.org/snippets/2684/<p>You only have to put the code in some of your models.py and to have django-fiber installed in your system. Every image uploaded using Fiber admin dialog will be automatically resized and thumbnailed. Or whatever you need to do with it.</p>
Freely redistributableResizeImageField
2010-09-29T17:49:55.335600-05:00wimhttp://djangosnippets.org/snippets/2212/<h1>ResizeImageField</h1>
<h1>(extension of RemovableImageField)</h1>
<p>by Wim Feijen, Go2People.</p>
<h2>What does it do?</h2>
<p>ResizeImageField is a replacement for django's ImageField. It has two major benefits:
1. Creation of thumbnails and scaled images.
1. Extends the image upload form and adds a preview and a checkbox to remove the existing image.</p>
<p>It's …</p>
Freely redistributableYet Another Image Resizer
2010-02-25T20:11:23.298721-06:00stephen_mcdhttp://djangosnippets.org/snippets/1944/<p>There's a whole range of examples online for resizing images in Django some of which are incredibly comprehensive with a wide variety of options. Here's my take on the task that serves as a simple drop in for when you don't want to include a separate app.</p>
<ul>
<li>Only generates the …</li></ul>
Freely redistributableUpdated Filter to resize a ImageField on demand (ver.2)
2010-01-25T11:35:28.660240-06:00rawjamhttp://djangosnippets.org/snippets/1887/<p>An update to snippet 1718 (http://www.djangosnippets.org/snippets/1718/). This update lets you pass an image URL string as well as a model ImageField instance. This means that you can then create thumbnails on demand for images outside of model</p>
Freely redistributableUpdated Filter to resize a ImageField on demand
2009-09-04T18:52:34.536071-05:00gmandxhttp://djangosnippets.org/snippets/1718/<p>Based on http://www.djangosnippets.org/snippets/192/
</p>
<p>But this works with Django 1.1 while maintaining the same functionality.
</p>
Freely redistributableImage resize on demand
2008-12-29T03:21:12.071652-06:00VidJahttp://djangosnippets.org/snippets/1268/<p><strong> Image on demand view </strong></p>
<p>I often post photos on photography fora. Most fora want you to place a link to a photo somewhere on the net, but different fora have different rules. Some fora want you to stick to a maximum of 800 pixels wide, some 700 pixel and some …</p>
Freely redistributableiPernity thumbnail helper
2008-11-15T09:30:16.108328-06:00seddenhttp://djangosnippets.org/snippets/1193/<p>A simple template filter that detects <a href="http://www.ipernity.com">iPernity</a> static URLs and creates clickable thumbnail for them. Use it with <a href="http://www.huddletogether.com/projects/lightbox2/">Lightbox</a> or any other funky image overlay script.</p>
<p>Your HTML code may contain this:</p>
<pre><code><p>A short example <img
src="http://...ipernity..."
title="The Description" />.</p>
</code></pre>
<p>After applying this filter it will become:</p>
<pre><code><p>A short example …</code></pre>
Freely redistributableresize to thumbnail with scale-to-fill
2008-09-30T17:57:01.280077-05:00rennathttp://djangosnippets.org/snippets/1100/<p><strong>So you can upload rectangular pictures but still have square thumbnails.</strong></p>
<p>"Scale to <strong>fill</strong>" instead of the out of the box "scale to <strong>fit</strong>" you get with <code>Image.thumbnail</code></p>
Freely redistributableA Django image thumbnail filter
2008-09-22T01:47:24.695194-05:00nidomediahttp://djangosnippets.org/snippets/1073/<p>I've gotten this code originally from Dan Fairs. I've edited it a bit to make it do what I wanted it to do. I've sent a mail and the original can be considered public domain code. The same is true for this</p>
Freely redistributableImage Standarization
2008-04-15T16:06:28.145749-05:00garcia_marchttp://djangosnippets.org/snippets/707/<p>Standarization of image fields (for being used when saving models). Automatically creates thumbnail. Change image name to /path/to/images/<my_field>-<id>.<ext>. Resize image and thumbnail to specified size (optionally can crop image to force size).</p>
Freely redistributableResize image on save
2008-04-07T12:08:13.197737-05:00Davidhttp://djangosnippets.org/snippets/688/<p>This snippet is extracted from my Photo model. I use it to ensure that any uploaded image is constrained to a specified size (resized on save).</p>
<p>In my case, I don't need to maintain a "thumbnail" and "fullsize" version, so I just store the resized version to save space.</p>
Freely redistributableFilter to resize a ImageField on demand
2007-04-19T07:56:00.643164-05:00micheltshttp://djangosnippets.org/snippets/192/<p>A filter to resize a ImageField on demand, a use case could be:</p>
<p><code><img src="object.get_image_url" alt="original image">
<img src="object.image|thumbnail" alt="image resized to default 200x200 format">
<img src="object.image|thumbnail:"200x300" alt="image resized to 200x300"></code></p>
<p>The filter is applied to a image field (not the image url get from <em>get_image_url</em> method of the model), …</p>
Freely redistributableFunction to create resized versions of an image from a URL and saving it to a local path
2007-02-28T15:48:37.413968-06:00obeattiehttp://djangosnippets.org/snippets/53/<p>This is a really useful function I used to create the resized preview images you can see on the <a href="http://www.obeattie.com/">homepage of my site</a>. Basically, it takes the original URL of an image on the internet, creates a resized version of that image by fitting it into the constraints specified …</p>
Freely redistributable