django-imagekit
django-imagekit copied to clipboard
Problem with ImageSpecField
When you set ImageSpecField at the same time with ImageFiled, ImageField will not work(will not create media folder and will not put uploaded image inside it). But ImageSpecField all the same will reference to 'media/CACHE/....jpg', that does not exist(actually, even 'media' folder doesn't exist).
So it's needed to start project without ImageSpecField at first time, and then add ImageSpecField. Actually, ImageSpecField doesn't check, whether image actually saved or not. It even doesn't check, whether the path exist or not. It just create some link and reference to it. Is this bug?
Can you give us code example of the problem?
I used the same code as in your tutorial.
from django.db import models
from imagekit.models import ImageSpecField
from imagekit.processors import ResizeToFit
class Item(models.Model):
image = models.ImageField('Image')
image_thumbnail = ImageSpecField(source='image',
processors=[ResizeToFit(100, 50)],
format='JPEG',
options={'quality': 88})
And with this when you see the error?
It doesn't show error, it just doesn't work. Doesn't create thumbs, doesn't create cache directory. I tried to use "image" application for creating thumbs, and it's worked.16.09.2016, 16:09, "Venelin Stoykov" [email protected]:And with this when you see the error?
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.
I never experienced such an issue and for that reason I wanted to know more details for your environment.
In your case when you upload an image the file for it is created in media, but when you try to visualize the image in template with:
<img src="{{ item.image_thumbnail.url }}">
you are seeing in the rendered html something like
<img src="/media/CACHE/images/image-name/some-random-characters.JPG">
but you are NOT seeing the image in the browser. Right?
And also if you change the code to {{ item.image.url}} everything is working. Right?
Yes, I am seeing link, but not image. There is not image and at all there is not cache directory. Just an html-link to nowhere. I use now "image" app(https://github.com/francescortiz/image), and it works nice.
I'm experience this aswell on django 1.10, the image thumbnail doesn't get created. No error messages are produced.
Ok I got it to work using python manage.py generateimages. I was using the Django admin interface to upload the images, is this not supported for ImageSpecField?
@silentjay you are using the code from current master branch right?