djangosnippets.org: Latest snippets tagged with 'images'https://djangosnippets.org/tags/images/2023-05-24T14:14:07.813738-05:00Image compression before saving the new model / work with JPG, PNG
2023-05-24T14:14:07.813738-05:00Schleidenshttps://djangosnippets.org/snippets/10949/<p>Don't forget to replace "self.image" by your image field name from your model ex ( self.cover )
replace Product by your model name</p>
<p>works pretty well :)</p>
Freely redistributableSimple "html email with images" sender
2011-02-28T07:50:26.340998-06:00andres_torres_marroquinhttps://djangosnippets.org/snippets/2371/<p>This will take your Django template and will search for images in <table> and <img> tags, and will replace it with attached files in the email to send. You can use it without a template param.</p>
Freely redistributableHTML Email with Inline Attachments (images)
2010-10-01T17:45:07.517540-05:00hunterfordhttps://djangosnippets.org/snippets/2215/<p>This will allow you to attach HTML multipart emails (HTML/text) and use inline images.</p>
<p>In my example, I'm attaching an image that's stored as an 'attachment' to an 'event.' The file name of the attachment is called "inline.jpg" and I'm referencing it in my HTML message. I'm also attaching a …</p>
Freely redistributableBetter Static Image Serving With Fallback
2010-03-21T18:40:20.855894-05:00menendezhttps://djangosnippets.org/snippets/1967/<p>Serves images from a local directory, but if it doesn't find it locally, then go look for it on a server. This is useful for sites with very large amounts of static content.
</p>
<p>Instead of copying all your prod images to dev every time you update the database, simply use …</p>
Freely redistributableIntegrate Wymeditor with filebrowser plugin
2008-11-18T03:41:52.231997-06:00jonasvphttps://djangosnippets.org/snippets/1201/<p>In order to integrate Wymeditor with the Django filebrowser, put the code in a file, set the fb_url variable to point to your filebrowser instance and add the file to your Javascript headers:</p>
<p><script type="text/javascript" src="/media/wymeditor/plugins/jquery.wymeditor.filebrowser.js"></script></p>
<p>or in your admin.py:</p>
<p>class Media:
js = ('/media/wymeditor/plugins/jquery.wymeditor.filebrowser.js',)</p>
<p>Add the postInitDialog parameter to …</p>
Freely redistributableImageFSStorage
2008-08-12T16:51:25.915014-05:00vicvicvichttps://djangosnippets.org/snippets/965/<p>A custom FileSystemStorage made for normalizing extensions. It lets PIL look at the file to determine the format and append an always lower-case extension based on the results.</p>
Freely redistributable