Can't select image in new Django filer in admin - django

I have a problem in a new Django app with filer.
I can upload an image from disk, but I can't select
this image to choose it. There is no arrow to pick up the image.
This is my screen
enter image description here

Related

Issue with Opencart theme activation

When I was loading the theme, I had to rename the theme archive from name.zip to name.ocmod.zip via Windows Explorer (the theme is displayed in the admin panel, so everything is OK).
The problem is that when I try to change the default theme to mine, I get errors like in the screenshots.enter image description here
enter image description here
enter image description here
enter image description here

Cloudinary upload image from Django admin panel from two or more databases

everyone. I decide to use Cloudinary for storing images.
This is my model field with image:
avatar = models.ImageField(upload_to='avatar/', default='avatar/default.png', blank=True)
All works fine for me, but I have one little issue.
When I uploaded the image from admin panel, cloudinary upload it to my cloudinary folder 'avatar' with some modified name, for example: 'july2022_kda4th' or 'july2022_aidkdk'
But when I uploaded this image from admin panel of another database (production), cloudinary upload the image with another name. So, I have two similar images in cloudinary. It's not convenient.
How can I fix it?
By default, if you don't supply a public_id in the upload API call, a random string is assigned to the asset. You can read more here: https://cloudinary.com/documentation/upload_images#public_id.
It sounds like you want to use the asset filename as the public_id so what you can do is:
In forms set use_filename=true and unique_filename=false as described in this link
OR if above is not working you can
Create an upload preset https://cloudinary.com/documentation/upload_presets
Enable Use filename or externally defined Public ID: option
Disable Unique filename:
Set this preset as the default upload API/UI (https://cloudinary.com/documentation/upload_presets#default_upload_presets) or include this upload_preset in your upload call

Modify image uploaded in django 2.0 before the image is saved to disk

I have a model with a FileField for document uploads (e.g. images, pdfs, or videos). I use this line in my Document model:
storage_file_name = models.FileField('File name', upload_to=unique_file_path)
and in unique_file_path I change the name of the uploaded document to a unique file name. I find that I will be uploading some tiffs, which I need to change to jpeg or something that a browser can easily display.
I have been looking for the best way to convert the uploaded tiff file to jpeg. Is there a way to do it before the image is saved to the disk, or is the best way to use a
#receiver(models.signals.post_save, sender=Document)
and save the converted image over the saved tiff image?
At this point I am only using the admin pages and not any custom views (except by customizing the admin pages).
Thanks!
Mark

Upload an image with AJAX, crop portion of our choice, and save in django admin

I need to give the admin the feature of uploading an image for an ImageField using AJAX, and then crop the portion of his choice (with a predefined dimension ratio or resolution) and then save the cropped image in the database.
I tried django-image-cropping and django-ajaximage for this.
#Using django-image-cropping
from image_cropping import ImageRatioField
class Alumnus(models.Model):
photo = models.ImageField(null=True, blank=True)
cropped_photo = ImageRatioField('photo', '430x360')
#Using django-ajaximage
from ajaximage.fields import AjaxImageField
class Alumnus(models.Model):
photo = AjaxImageField(
upload_to='alumni_photos',
max_height=400,
max_width=400,
crop=True
)
While django-ajaximage uploads an image using AJAX, but it doesn't allow the admin to choose which part of the image he wants to be cropped, django-image-cropping crops an image in two steps: first we need to upload an image, save it to the db, then again we need to open the object and select crop portion, and save it again to the database, which i feel is unnecessarily cumbersome. Any suggestions?
It looks like you'll need a JS library in the browser that does the actual cropping. Then you can use AJAX to send it to the server.
DarkroomJS might be just what you need. It uses the HTML5 canvas to do the image editing in browser. It's actually got a few more features than you need, but it should get the job done.
The django-client-side-image-cropping library crops the image on client-side (Using the Croppie Javascript library) to a specific size. It is compatible with django-admin sites. It does not use AJAX. It uses InMemoryUploadedFile to temporarily store the original file.
django-cropper-image is an app I made for client side cropping and compressing uploaded images via Django’s app using with help cropper.js. github link django-cropper-image.
from django.db import models
from django_cropper_image.fields import ImageCropperField
class Images(models.Model):
image = ImageCropperField(upload_to='image',max_length=255)

images on django site from matplotlib

I am looking to have an entry form where you can enter in a server name and end up getting several png images displayed that are created from matpotlib.
I can create the form, and have the scripts written that create the image files. I am wondering what the best way to deal with the images are. Is there a way I can display the resulting png file to the browser but not save it to disk?
Want to avoid cluttering up a directory with the generated images after they are displayed the the browser. Should I just delete the image after its rendered?
response = HttpResponse(mimetype="image/png")
img.save(response, "PNG")
return response