Questions tagged [imagefield]

A place to store or display a graphic image.

"Image field" is a generic term that typically would belong in a or setting such as:

It appears to be a synonym for .

342 questions
1
vote
2 answers

How to display Image from ImageField in Django to user?

I am trying to display an image from an imagefield in Django. The imagefield works correctly. I can save an image to local storage, but the problem is that when the server is running, I see a url in the place of the imagefield. I'm guessing it…
Zelda
  • 47
  • 1
  • 10
1
vote
2 answers

Django form ImageField

I'm trying to establish CreateView for the model which holds ImageField. I can successfully upload and display images from django admin page. But, when I upload images from my own form, django doesn't upload images to "upload_to" folder. I'm writing…
Elgin Cahangirov
  • 1,932
  • 4
  • 24
  • 45
1
vote
1 answer

Updating properties of a Django model on save with processing of submitted ImageFields

Basically I'm trying to save a Django model which contains an ImageField, and updates its latitude and longitude FloatFields with values grabbed from the EXIF data contained in the image, if any. Here's a sample model illustrating the issue: class…
NiKo
  • 11,215
  • 6
  • 46
  • 56
1
vote
1 answer

iTextSharp Fill Pdf Form Image Field

I created a pdf form with Acrobat DC 2015. I have a image field on it. I fill text field succesfully. But I don't know how to fill image field. Do you help me? private static void FillPdfForm() { // Original File const string…
Circas Creed
  • 95
  • 1
  • 8
1
vote
2 answers

How to save an image from Google Places API to an ImageField in a Django app?

I'm building population code to populate Django model 'City' with images from Google Places API. This is the model: class City(models.Model): city_image = models.ImageField(blank=True, upload_to='city_pictures') I built the API URL that returns…
Seif
  • 566
  • 2
  • 10
  • 21
1
vote
1 answer

Save image in Django from Android app

I was having problem while saving picture in Django from Android app. I searched and finally solved the problem. I am sharing this so that it might help. Please see the answer below.
Zohab Ali
  • 8,426
  • 4
  • 55
  • 63
1
vote
1 answer

Duplicate an ImageField in another field of same model while saving the model objects

I want to upload one image(location of which stores in photo field of model mentioned below ) and I want to duplicate that photo to another field thumbnail programmatically. I tried in the way mentioned in class Picture(models.Model): below.…
S.Hillol
  • 79
  • 1
  • 8
1
vote
0 answers

Overriding url() from ImageField

I have a image field avatar = models.ImageField(upload_to="avatar", null=True, blank=True) and using view class EditView(SuccessMessageMixin, UpdateView): model = MysiteUser form_class = MysiteUserForm pk_url_kwarg = 'pk' template_name =…
darek_82
  • 361
  • 1
  • 3
  • 13
1
vote
2 answers

Saving an image into user model

I'm trying to make an "avatar" field in my user model (tried using all libraries out there, didnt quite like them) class UserProfile(models.Model): user = models.OneToOneField(User, related_name='profile') ... pic =…
petru
  • 15
  • 6
1
vote
1 answer

Error when uploading an image to ImageField via Django Admin

Trying to upload a picture via the Django admin panel and I'm getting an error. The model is: fs = FileSystemStorage(location='/media') class Picture(models.Model): picture_path = models.ImageField(upload_to=fs, blank=True) hunter_ID =…
manchakowski
  • 127
  • 1
  • 1
  • 11
1
vote
1 answer

Changing file name on upload using id in Django ImageField

In this model, I want to change the name of the file uploaded in ImageField class Product(models.Model): image = models.ImageField(upload_to=content_file_name) name = models.CharField(max_length=100) amount =…
Jose Angel
  • 328
  • 2
  • 16
1
vote
2 answers

ValueError on ImageField when trying to delete image or creating new user in Django

I have put an ImageField on my Django model, and with the pre-existent profiles it works (the image upload), but I can't delete the image from the admin panel and I can't create a new user. The thrown error is: ValueError at…
Stefano De Rosso
  • 1,309
  • 1
  • 14
  • 27
1
vote
0 answers

How to allow users to upload a post with pictures in Django?

This is what I have at the moment in my models.py class Document(models.Model): docfile = models.FileField(upload_to='documents/%Y/%m/%d') img = models.ImageField(upload_to='documents/%Y/%m/%d', null=True, blank=True) admin.py# from…
robert
  • 31
  • 8
1
vote
2 answers

Django Add first image

I have some problem with adding image to my project. Settings: MEDIA_ROOT = '/static/uploads' MEDIA_URL = '/uploads/' Model: class UserLogo(models.Model): upload_path = '/static/uploads' logo = models.ImageField(verbose_name="Logo",…
Patryk
  • 23
  • 1
  • 4
1
vote
1 answer

Django template doesn't display ImageField

I have a model where there is a ImageField but in the template doesn't appears. The upload of the image is OK (in media_root/one/image.jpg) Settings.py: MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR,…