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

ImageField is not uploading to specified directory

I have been googling this for an ours and can't find the solution. When I use admin panel, image is loading to the directory that is needed. But when I create post from the frontend, the image is just loading to the main directory, which is media. I…
Boris
  • 37
  • 6
1
vote
1 answer

cck image disappears when making node_save

I save a node with images which is beeing filled by a service. I write the image with drupal_write_record and the pictures appear in the node already. But when - at the end of the script - I call a node_save the image disappears again. My Code: …
Andreas
  • 11
  • 1
1
vote
1 answer

Django - How to leave ImageField blank if user doesn't upload image

I'm trying to build a recipe app that allows users to upload images and save recipes in a list. The problem I'm facing is when the user doesn't upload an image, I get error: attribute has no file associated with it. Error I've looked in Django…
1
vote
2 answers

Uploading Image in Django: 'utf-8' codec can't decode byte 0x89 in position 246: invalid start byte

I'm trying to upload images in my api using pure json, but when i tried to upload image in request.Files and the token in request.body, I face this error: UnicodeDecodeError at /api/auth/set-profile-image/ 'utf-8' codec can't decode byte 0x89 in…
Nabil
  • 41
  • 1
  • 8
1
vote
1 answer

LINQ to XML and GridView.ImageField

i am wanting to know how to add an image to a gridview based on the imageurl in a xml document. so far i have... XDocument xmlDoc = XDocument.Load(Server.MapPath("XMLFile.xml")); var q = from c in xmlDoc.Descendants("Images") where…
Kev
  • 41
  • 1
  • 1
  • 3
1
vote
1 answer

404 (Not Found): How to show an image of a model in html?

I am currently trying to figure out why I get a 404 Error (not found). I have uploaded the ImageField of my Model to the static file 'article_img'. But when I want to show the stored image on the html site, the resource cannot be found. What is the…
ynynloxx
  • 11
  • 1
1
vote
0 answers

Why do new media files appear by themselves in my django application?

I have recently added new ImageField to my Bird model in Django application. # models.py class Bird(models.Model): name = models.CharField(max_length=50) project = models.ForeignKey( Project, related_name='birds', …
Petr Hofman
  • 162
  • 1
  • 15
1
vote
2 answers

How to defaultly return image.url when we get model Object?

I want my model object to always return the image.url of field image. My model: class Content(models.Model): ... avatar = models.ImageField(upload_to=file, blank=True, null=True) I want something like: class Content(models.Model): ... …
Osman Omar
  • 433
  • 1
  • 7
  • 19
1
vote
1 answer

How do I delete the previous saved image and save the new one without duplicating? Django

I'm having trouble saving image. My Model is this class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) image = models.ImageField(default='default.jpg', upload_to='profile_pic') def __str__(self): return…
1
vote
0 answers

Django Upload SVG to ImageField

Looking to see if anyone has come up with a creative approach for storing SVG files in an ImageField. Out of the box django doesn't support storing of SVG files in an ImageField. There's a (a few) hack(s) out there that allow the SVGs to be stored…
1
vote
2 answers

How to make ImageField returns relative path?

I don't know why, but my ImageFields return full URL pathes. This is MEDIA_URL setting: MEDIA_URL = '/cc/cc/media/' I use this custom FileStorage: class ASCIIFileSystemStorage(FileSystemStorage): def get_valid_name(self, name): return…
Alexander Shpindler
  • 811
  • 1
  • 11
  • 31
1
vote
1 answer

Django ImageField: full or relative path?

I try to implement pictures uploading and processing in my Django project. The problem is with path for ImageField: Option 1. If I use path relative to the media folder, then image.url nicely returns /media/img_name.jpg, and Django handles the…
AivanF.
  • 1,134
  • 2
  • 23
  • 52
1
vote
1 answer

django optimize, rename, resize image on first save

I would like to resize and optimize image on save. But only on the first save of image, not on all save. Also I would like to rename file and automatically overwrite old file if new file is uploaded. Goal is to rename images to…
1
vote
1 answer

Can a wagtail ImageField be restricted to by image dimension

Can I set make a Wagtail ImageField only accept images of of certain dimensions ?
Stuart Axon
  • 1,844
  • 1
  • 26
  • 44
1
vote
1 answer

Using Drupal 7, how do you add fields to images, similar to imagefield_extended in D6?

I'm attempting to add an additional field to images. e.g. position, left or right. So the user can add multiple images and specify left or right position. In Drupal 6, one would use imagefield_extended or cck multigroup. Using Drupal 7, how do you…
troynt
  • 1,900
  • 15
  • 21