Comments (5)
Hey @rocjojo –
I'm a bit confused by your ticket. You said 'When i use the standard ImageField in my serializers, the full url is displayed, everything works fine'...would you mind responding with the output from 'the standard ImageField' serializer and how it differs from what you're expecting the VersatileImageFieldSerializer
to output?
from django-versatileimagefield.
Hey,
My problem is, as soon i use the VersatileImageFieldSerializer in my ModelSerializer, the urls become absolute in the json response.
Output of the logo field from the serializer without declaring the VersatileImageFieldSerializer in the Serializer :
In [7]: print ser.ShopSerializer(shop).data['logo']
/media/shop/VS/1890/fff/e3f27044-09f8-45bd-89b8-f43b10c778a4
GET request gives
"logo":"http://192.168.99.100:3001/media/shop/VS/1890/fff/e3f27044-09f8-45bd-89b8-f43b10c778a4"
Output of the logo field from the serializer with the VersatileImageFieldSerializer
logo = VersatileImageFieldSerializer(
sizes=[
('full_size', 'url'),
('thumbnail', 'thumbnail__100x100'),
('medium_square_crop', 'crop__400x400'),
('small_square_crop', 'crop__50x50')
]
)
In [5]: print ser.ShopSerializer(shop).data['logo']
{'medium_square_crop': '/media/__sized__/shop/VS/1890/fff/e3f27044-09f8-45bd-89b8- f43b10c778a4-crop-c0-5__0-5-400x400.jpg', 'small_square_crop': '/media/__sized__/shop/VS/1890/fff/e3f27044-09f8-45bd-89b8-f43b10c778a4-crop-c0-5__0-5-50x50.jpg', 'full_size': '/media/shop/VS/1890/fff/e3f27044-09f8-45bd-89b8-f43b10c778a4', 'thumbnail': '/media/__sized__/shop/VS/1890/fff/e3f27044-09f8-45bd-89b8-f43b10c778a4-thumbnail-100x100.jpg'}
GET request gives
"logo":{"medium_square_crop":"/media/__sized__/shop/VS/1890/fff/e3f27044-09f8-45bd-89b8-f43b10c778a4-crop-c0-5__0-5-400x400.jpg","small_square_cr
As you can see, the "http://192.168.99.100:3001" part disappeared.
Thank again for your help.
from django-versatileimagefield.
@rocjojo –
Ahhhh, I see what's happening now. I'm working on the fix right now and will let you know when it's patched!
from django-versatileimagefield.
Hey @rocjojo !
The fix for this is available in the 1.0.6 release which I just uploaded to PyPI. Get it via pip:
$ pip install django-versatileimagefield==1.0.6
Thanks for contributing to django-versatileimagefield! :)
from django-versatileimagefield.
Yeah it works !
Glad to contribute to your project, thanks for your quick patch :)
from django-versatileimagefield.
Related Issues (20)
- Contact failed HOT 1
- Unclear docs on using VersatileImageFieldWarmer with rendition sets HOT 1
- python-magic 0.4.20 incompatible
- Fails to work with django-cacheops HOT 2
- How to store filename returned by storage for sized images? HOT 1
- Test with Python3.9
- Test with Django 3.1 and 3.2
- Add Django 3.2 Compatibility HOT 1
- Test with djangorestframework 3.11 and 3.12
- error to upload images using django-rest and angular HOT 1
- versatileimagefield How to use Django Graphql
- Deleting all created images for the image without extension fails
- VersatileImageFieldWarmer regenerate images for delete rendition key set
- Question: is it possible to use this app with static files?
- AttributeError: module 'magic' has no attribute 'from_buffer' HOT 1
- Django 4 HOT 3
- Question: Crop as circle
- Extra queries when warming with VersatileImageFieldWarmer
- django-versatileimagefield doesn't work on Pillow >= 10.0.0 released 1 July HOT 5
- Created images not deleted when using image_key_post_processor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-versatileimagefield.