Open oetiker opened 12 years ago
Hi, thanks for your issue report.
Please update your local copy with that latest changes. Silverstripe's internal filename handler strips these characters ( see File::setName() ). As we're doing file handling before a File object is available a CleanFileName() method has been introduced.
See: https://github.com/codem/DisplayAnything/commit/1fd9e4ee224f88a589cbb22306e09f9a593d333f#diff-5
It's worth noting that "pröblem.jpg" will become 'prblm.jpg" everywhere now. It's entirely possible to include "ö" and simliar characters in the filename and database but I want to maintain compat. with File::setName() and I'm not even sure if "ö" and friends is supported on Windows anyway.
Give it a burl and report any issues!
Thanks James
Hi James,
thanks ... just tested your new code ... I had to remove the Object::add_extension('Image', 'WatermarkedImageDecorator'); from _config.php since this extension is not available ... as there are other mentions of Watermark in your code, I guess there might be some further fallout from this.
Also the result of it all is, that (at least with the latest chrome) I am not able to upload files with umlauts in there name at all anymore. The js code complains about bad filename extensions ... while in reality, the problem seems to be that the input field does not even provide the name of the uploaded file anymore as soon as there are umlauts in the name ... very odd ... maybe a chrome bug ?
That's weird, it's there in the source:
https://github.com/codem/DisplayAnything/blob/master/code/dataobjects/WatermarkedImage.php
Did you update your manifest ? - run ?flush=1 and a /dev/build
I tested the change with a file named "pröblem.jpg" and it worked fine, although the resulting filename was prblem.jpg
The readme.md file has more info on watermarking.
got the WatermarkedImage working ... the flush bit obviously helped ...
as far as uploading images with umlauts in the name goes, it does not work for me (linux, chrome-dev, iso-latin1 locale), setting a breakpoint on line 825 I can see the imput elements fileList, attribute it contains one file element. But all the properties are "" or null. If I select a filename without umlaut, then all works well ... my guess is that something in chrome is going pearshape ... BUT at your end, you might want to check for this condition to show a more sensible error message than to just complain about bad file extensions when in fact you did not get a file name at all.
That is odd. I tested the latest changes in chrome 19 beta, Linux with a file containing umlauts - I switched to DE locale and typed in the umlauty filename. Result being that the file uploaded fine. the backend is in UTF8 though (mySQL & PHP).
I will try again but you may have to send me the file if I can't duplicate the issue.
Out of interest, what is "mlts" ?
Thanks. On May 5, 2012 7:54 PM, "Tobias Oetiker" < reply@reply.github.com> wrote:
got the WatermarkedImage working ... the flush bit obviously helped ...
as far as uploading images with umlauts in the name goes, it does not work for me (linux, chrome-dev, iso-latin1 locale), setting a breakpoint on line 825 I can see the imput elements fileList, attribute it contains one file element. But all the properties are "" or null. If I select a filename without umlaut, then all works well ... my guess is that something in chrome is going pearshape ... BUT at your end, you might want to check for this condition to show a more sensible error message than to just complain about bad file extensions when in fact you did not get a file name at all.
Reply to this email directly or view it on GitHub: https://github.com/codem/DisplayAnything/issues/14#issuecomment-5525845
I will investigate further ... mlts are the non vowels in umlauts
Ok thanks, can you copy the actual error message. Is line 825 in your HTML source or a file within the module ?
that is the line in the javascript file where the onChange method is called as a response to a modification in the tag ... inspecting that I see that the fileList array contains one object where all the properties are set to null ... (if I choose a file with umlaut in the name.) If I chooses a normal file, the array a normal file item ...
but as I am using the dev version of chrome this may well be caused by the browser ...
aha, that line is in the File Uploader library
https://github.com/valums/file-uploader
DA just implements that library, nothing else.
You may find digging around in there or its forks may turn something up. Still, odd that I could upload with an umlaut in Chrome 19 (beta channel) and you can't. Maybe clearing the cache (reaching!) ? What does stable Chrome do ?
If I upload a file with umlauts in the name (or probably any other non ASCII character) these characters get stripped from the name when the filename is recorded in the database while the actual upload keeps its format:
Example:
client: pröblem.jpg
uploaded to display_anything
filesystem: assets/gallery/pröblem.jpg
database: assets/gallery/prblem.jpg