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
3
votes
0 answers

Django - how can I set default image for an ImageField model

I have an imagefield type for my model class Attendance(models.Model): face_image = models.ImageField() the question is if I have an image in static, how can i assign it to this imagefield ? if not it could be from a url the image, how can i…
Axil
  • 3,606
  • 10
  • 62
  • 136
3
votes
2 answers

Django ImageField Image Not Displaying

I'm trying to use Django 2.0. I'm using the development 'runserver' right now, so please keep in mind that I'm not in production yet. I am familiar with the differences between the two with regard to static files. I have a Blog Post model. In the…
Ron Raney
  • 372
  • 2
  • 4
  • 14
3
votes
3 answers

Django image upload not uploading japanese named image

The error i am getting when uploading japanese named image is : ascii' codec can't encode characters in position 45-48: ordinal not in range(128) Images are uploading perfectly when named in english characters. Also, it's strange that the error i am…
Ash Singh
  • 3,921
  • 2
  • 25
  • 30
3
votes
4 answers

How to Find Django ImageField URL

I'm trying to accomplish something I believed would be simple: upload an image (via admin), then use the complete URL in a template to display the image. The problem is I can only print the relative URL: /pics/filename.jpg. I believe the sequence…
E. Sutherland
  • 101
  • 2
  • 3
  • 9
3
votes
2 answers

Django - ImageField, upload, store and serve image in development server

I'd like to have an ImageField in the admin form for my model (say, for an individual's profile). And I'd like to display this image in a view later on. This is the model I have : class Individual(models.Model): ind_name =…
GuitarExtended
  • 787
  • 2
  • 11
  • 32
3
votes
1 answer

Django - Display imagefield in ManytoMany form instead of title

I am working on a Django project with crispy forms. I want to use images instead of the the default Models title/label to select a instance in a Many to Many relation form. Content models.py: class Cloth(models.Model): owner =…
3
votes
1 answer

Displaying ImageField in HTML Flask

I am having some problems getting images from the database and showing them in my webpage. First of all, I am using mongoengine, so here goes (part of) my models.py: class Picture(EmbeddedDocument): image = ImageField() class Post(Document): …
Larissa Leite
  • 1,358
  • 3
  • 21
  • 36
3
votes
1 answer

Django Rest Framework imageField to server

Currently I am trying to use an imageField to pass images from my model to an endpoint, but I don't know how to go about it. Here is my model: class searchResultsItem(models.Model): """ Model to store search results item for a tableView…
3
votes
1 answer

Can't create image field in Django app

I'm working on a Django app whose core functionality is based around storing photo albums. I'm using Django 1.8.1 with Python 3. Here are the models I've created so far: import uuid from django.db import models from django.conf import settings from…
Matthew Daly
  • 9,212
  • 2
  • 42
  • 83
3
votes
1 answer

How to render images on Django template

See my GitHub https://github.com/rg3915/gallery How to render images on Django template? But he is returning: Gallery media/3665_1280x800_8UX8tgG.jpg Tour de France media/281405_fSRBDZu.jpg bike of children How to render the images? Does the bug is…
Regis Santos
  • 3,469
  • 8
  • 43
  • 65
3
votes
1 answer

How to Create a MongoDB/mongoengine ImageField from POSTed base64-encoded image?

I have a small Python/Flask application that should store a picture in MongoDB. The a client submits a HTTP POST (JSON) with one of the fields being the base64-encoded image. The server should store this image in a MongoDB ImageField. I'm using…
3
votes
2 answers

Drupal Imagfield/Filefield in custom form

i have created a module with this among others this function in it: 'post', '#attributes' => array( 'enctype' => 'multipart/form-data', …
joar
  • 15,077
  • 1
  • 29
  • 54
3
votes
1 answer

Saving a matplotlib graph as an image field in database

I just started learning matplotlib and I want to use it in one of my django apps. So I wanted to know how I can save the graph generated in an image field of my models, so that I can retrive whenever needed.
Aswin Murugesh
  • 10,831
  • 10
  • 40
  • 69
3
votes
2 answers

Django "TypeError: an integer is required" on form.save

I have a form with 11 fields and one image upload field. After filling in and hitting submit, I'm given a TypeError saying that an integer is required. this error doesn't come up if i remove the imagefield. checking the image directory, the files…
3
votes
2 answers

Django custom validation in model form for imagefield (max file size etc.)

I have a modelform that has an imagefield called 'banner' and I am trying to validate the file size and dimesions and provide an error if the image is too large. Here is the models.py: class Server(models.Model): id = models.AutoField("ID",…
Octobox
  • 335
  • 5
  • 7