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
4
votes
2 answers

how to pass an initial value to an imagefield in a django form

Currently I am using something like: initialValues={ 'textField1':'value for text field 1', 'textField2':'value for text field 2', 'imageField': someModel.objects.get(id=someId).logo } form = myForm(initial=initialValues) When I…
marlboro
  • 254
  • 6
  • 16
4
votes
2 answers

Do I need extra code for Image Field in Django

I have this in Model image_name = models.ImageField(upload_to='accounts/') In my view I have def account_form(request): if request.method == 'POST': # If the form has been submitted... form = AccountForm(request.POST) # A form bound to…
Mirage
  • 30,868
  • 62
  • 166
  • 261
4
votes
1 answer

File : "Upload a valid image" using Postman in Django Rest Framework

I am using Django Rest Framework to upload profile picture and Google Cloud Storage to store my images. I test my API with Postman and i have this result : Postman result And here is my Postman headers : Postman headers This is my code : class…
4
votes
1 answer

Django ImageField will not display on webpage

I am using an imageField in my Django model and the photo is not being recognized when I try to display it in the html. Here is my models.py from django.db import models class LatestRelease(models.Model): title =…
Jordan Harris
  • 343
  • 1
  • 4
  • 16
4
votes
2 answers

How can I use South's DataMigration to change the storage backend of Django model ImageField instance?

I'm trying to migrate some models ImageFields to using the S3BotoStorage storage backend from django-storages. As part of this process I've changed my Model's ImageField declaration to include the storage=instance_of_s3botostorage argument, and…
markhellewell
  • 24,390
  • 1
  • 21
  • 21
4
votes
1 answer

django: ImageField, MEDIA_ROOT, MEDIA_URL, how to set correctly

How should MEDIA_ROOT and MEDIA_URL be set correctly in context of ImageField? How should I set upload_to parameter for an ImageField? Comments for MEDIA_ROOT and MEDIA_URL are scarce, so I would like to know, what are they used for and how to set…
gruszczy
  • 40,948
  • 31
  • 128
  • 181
4
votes
1 answer

Django ImageField [Errno 13] Permission denied even though directory is writable

I included an ImageField field in my "sponsors" model, which is set to save the uploaded image files to my_app/static/uploads/sponsor_logos, and when I try to save a record using the admin interface, I get the following error: OSError at…
user1933387
  • 41
  • 1
  • 2
4
votes
2 answers

Drupal 7: Rename files on upload (via filefield)

I am looking for a way to rename files that are uploaded by users through a filefield. For example, rename user profile photos using uniqid. I found a good solution for D6 at "Drupal 6: How to Change Filename on Upload" but can't find anything for…
Eugene
  • 41
  • 1
  • 3
4
votes
2 answers

django accessing uploaded files in model custom save, best practice?

Ive recently been experiementing with using django I want to be able to run an uploaded file through imagemagick on the model save function, I realised this wasn't possible due to the file not being available till the instance had been saved I've…
3
votes
4 answers

django imagefield upload_to does not work at all

I've written a simple django app to test ImageField, but I'm running into problem where upload_to just doesn't seem to work. Below is the code: 1 from django.db import models 2 3 # Create your models here. 4 class TestImage(models.Model): …
pinghsien422
  • 19,836
  • 1
  • 20
  • 22
3
votes
0 answers

Django CKEDITOR, Image Upload path different with ImageField upload path

I'm using django-ckeditor to load images.I can't merger my image upload path in model with django-ckeditor image upload path. I have already created a upload image path in models: content = RichTextUploadingField(blank=True, null=True) image =…
williamfaith
  • 247
  • 2
  • 4
  • 9
3
votes
1 answer

Django error "'ImageFieldFile' object has no attribute 'replace'"

The error message is: AttributeError at /projects/ 'ImageFieldFile' object has no attribute 'replace' Request Method: GET Request URL: http://localhost:8000/projects/ Django Version: 2.2.5 Exception Type: AttributeError Exception…
rawbzilla
  • 35
  • 1
  • 4
3
votes
1 answer

Preview the photo after selecting the file in Django

I can not find information on this topic. How to easily create a preview of the photo in Django after selecting it (before saving the form). As on the video below: https://youtu.be/HVd2v1aUED0 Is there any simple plugin that will enable this? I…
Maddie Graham
  • 2,019
  • 4
  • 25
  • 51
3
votes
5 answers

Can't find an input type=image value in $_POST

Well may be it is to easy question but: I want to sort the numbers by clicking an image. I thought that i make a form and add an imagefield.
echophp
  • 43
  • 1
  • 1
  • 6
3
votes
2 answers

Django Form Imagefield validation for certain width and height

I am trying to validate the image dimension in form level and display a message to user if submitted photo does not meet requirement which is image dimension 1080x1920. I dont want to store the width and height size in database. I tried with the…
Jhon Doe
  • 113
  • 1
  • 11
1 2
3
22 23