djangosnippets.org: Latest snippets tagged with 'imagepreview'https://djangosnippets.org/tags/imagepreview/2020-01-28T21:17:43.951410-06:00Read image url as base64
2020-01-28T21:17:43.951410-06:00agusmakmunhttps://djangosnippets.org/snippets/10763/<p>Read the image url as base64 in django, this snippet usefull if you using the <code>django-easy-pdf</code> to solve this issue https://github.com/nigma/django-easy-pdf/issues/53</p>
<p>Usage example:</p>
<p><code><img src="{{ profile.photo.url|read_image_as_base64 }}"></code></p>
Freely redistributableClearableFileInput with image preview
2011-10-26T13:13:08.403006-05:00pafahttps://djangosnippets.org/snippets/2581/<p>This widget allows you to display preview images with adjustable width and length of the link:</p>
<p><a href="http://img526.imageshack.us/img526/6588/screenshotat20111026215.png">example</a></p>
<p>AdvancedFileInput(preview=True, image_width=200)</p>
<p>For other files, you can adjust the length of the link without preview:</p>
<p><a href="http://img845.imageshack.us/img845/6588/screenshotat20111026215.png">example</a></p>
<p>AdvancedFileInput(preview=False, url_length=30)</p>
<p>by default, parameters are:</p>
<p>preview = True</p>
<p>url_length = 30</p>
<p>image_width = 200</p>
Freely redistributable