yawd-elfinder
yawd-elfinder copied to clipboard
Elfinder doesn't preview image
at official site
at my django app
no js errors in firebug. The only have changed in code - fuction, returning mime, always return none, because I don't want to use magic. last from pypi, django 1.4, don't work all browsers
In my environment the preview functionality works as expected. Although I have not reproduced your code changes, you might need to ensure the correct mimetype is used; that's how the app will know how to preview the file. Your screenshot makes me think yawd-elfinder takes Hydrangeas.jpg for a typical file (eg doc, archive file) instead of an image.
As for the browser issue, does the 0.09.x
branch (which holds the latest Django1.4 compatible code) work for you? If not, which browsers do brake? We want to take a look into this, especially in case it affects the current master as well.
I changed: filesystem.py
def _mimetype(self, path):
"""
Attempt to read the file's mimetype
"""
return None #unicode filename support
storage.py
def _mimetype(self, path):
"""
Attempt to read the file's mimetype.
"""
fp = self._fopen(path)
mime = None
fp.close()
return mime
def _local_file_mimetype(self, path, name = ''):
"""
Return local file mimetype. Used on quarantined files.
"""
if os.path.isdir(path):
return 'directory'
mime = None
int_mime = None
if not mime or mime in ['inode/x-empty', 'application/empty']:
int_mime = mimetypes.guess_type(name if name else path)[0]
return int_mime if int_mime else mime
browsers - ie 9 firefox 18.0.1 text files preview works well
thanks for quick reply =)
I can't work with magic, because on windows it tells me: "could not find any magic files"
, and even this solution doesn't work for me( http://stackoverflow.com/questions/14761961/missing-files-for-magic-library-on-windows