Comments (7)
Hello, can you please describe me the problem and the steps to reproduce it? I'm willing to investigate this asap since we have also used sorl-thumbnail in the past and might also need it in the future.
from yawd-elfinder.
sorl thumbnail trying to find image in wrong path
image = ElfinderField(optionset='image')
{% load thumbnail %}
{% thumbnail item.image "100x100" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}
No such file or directory: u'/path_to_my_project/media/llffim_ZGljdG9waG9uZS1idWcucG5n'
from yawd-elfinder.
since item.image
is an ElfinderField
, you should do:
{% thumbnail item.image.url "100x100" as im %}
instead of {% thumbnail item.image "100x100" as im %}
Please tell me if this fixes it for you, for more info see this section of the yawd-elfinder documentation:
http://yawd-elfinder.readthedocs.org/en/latest/usage.html#django-templates
from yawd-elfinder.
Attempted access to '/media/images/my_image.png' denied.
from yawd-elfinder.
sorry you are right, I see that sorl-thumbnail needs the absolute path instead of the url. I'll work on this as soon as possible, this fix must make it to the upcoming yawd-elfinder release this week.
from yawd-elfinder.
Great, I'll wait.
from yawd-elfinder.
This turns out to by a problem originating from sorl-thumbnail path detection algorithm. Since in some cases (like when using the default yawd-elfinder optionsets) the image url is relative, sorl thinks the argument is a file path instead of a url. To solve this create a custom filter like this (tested with sorl-thumbnail 11.12):
@register.filter('fullurl')
def fullurl(value):
return 'http://localhost:8000%s' % value
and then in the template code
{% thumbnail item.image.url|fullurl "100x100" as im %}
Of course you could optimize the filter for dynamically retrieving the current domain (if you use the django sites framework for example), the above is mostly for demonstration purposes. I don't think we should change something in yawd-elfinder, especially since we support multiple drivers that could return either relative or absolute urls. Hopefully this workaround is sufficient for you, for more info please see also
this related issue http://stackoverflow.com/questions/7490684/using-static-images-with-sorl-thumbnail and the sorl-thumbnail documentation on how it resolves the image path http://sorl-thumbnail.readthedocs.org/en/latest/template.html#source
from yawd-elfinder.
Related Issues (20)
- maxArchiveSize to allow string decaration
- The widget does not display an image thumbnail when the file is touched (or in afresh checkout)
- Moving File forward and backwards again causes Error. Solution appended HOT 2
- ELFINDER_LANGUAGES : next code does not add language file to javascript media. HOT 2
- Exception when upload file with no ascii filename. (no unicode support) HOT 2
- ElfinderConnectorView and post request when debug false HOT 2
- ElfinderConnectorView and post request when debug false HOT 1
- Elfinder and not staff members HOT 2
- Elfinder doesn't preview image HOT 2
- Flask usage HOT 6
- Elfinder don't work in Inline HOT 1
- 'acceptedName' : r'.odt dont work for me, HOT 1
- Elfinder settings must be contain only strings. HOT 3
- Django 1.5.1 HOT 1
- PIL Requirement HOT 1
- update python-magic==0.4.6
- elfinder in django 1.6 HOT 8
- zip doesnt work
- this project is dead
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 yawd-elfinder.