Login

Tag "imagefield"

Snippet List

get and image object

I use this snippet to save images to my imagefields on django models. This uses the very awesome requests library, so install it first pip install requests You probably want to have this be done on a celery queu, if the image is big enough.

  • imagefield
  • save file
  • save url
Read More

ClearableFileInput with image preview

This widget allows you to display preview images with adjustable width and length of the link: [example](http://img526.imageshack.us/img526/6588/screenshotat20111026215.png) AdvancedFileInput(preview=True, image_width=200) For other files, you can adjust the length of the link without preview: [example](http://img845.imageshack.us/img845/6588/screenshotat20111026215.png) AdvancedFileInput(preview=False, url_length=30) by default, parameters are: preview = True url_length = 30 image_width = 200

  • imagefield
  • preview
  • imagepreview
  • previews-on-imagefield
Read More

Load File From URL Widget

Rather simple usage, modelforms/in the admin: class CustomAdminForm(forms.ModelForm): class Meta: model = Something widgets = { 'image': URLFileInput(default_exts=[".png", ".gif", ".jpg"]), } class SomethingAdmin(admin.ModelAdmin): form = CustomAdminForm admin.site.register(Something, SomethingAdmin) Basically, this will pull the image from the URL instead of only pulling it from your harddrive for upload. Also accepts optional default_exts argument which limits the file types. Defaults to images.

  • imagefield
  • filefield
  • urlfield
Read More

Updated Filter to resize a ImageField on demand (ver.2)

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

  • image
  • templatetag
  • thumbnail
  • resize
  • imagefield
Read More

ImageField for Google App Engine

This is a replacement for Django's built-in ImageField. It uses the Google AppEngine image APIs in order to validate. Notes: 1. Validation of the field counts against your App Engine transformations quota. 2. This code assumes you're only using the in-memory file upload handler. None of the other stock handlers work well on App Engine; you should probably disable them.

  • fields
  • imagefield
  • google
  • appengine
  • gae
Read More

30 snippets posted so far.