I'm not finding anything in the plugin repository, or ZP directly, so thought I'd ask before I built one for myself...
Has someone built a utility within ZP that can be kicked off to find and cleanup file names within an album? Optimally, this utility would look for any file name that contains spaces, and/or caps, and or other dodgy characters and change them to all-lower, browser and php-friendly characters.
Now, I know ZP handles this when uploading via ZP directly, but I've got 100's of photos that I've ftp'd which contain all manner of camel-case, spaces, tildes, and such.
This request comes after a day's worth of fiddling around trying to figure out why imagecreatefromjpeg() was acting so inconsistently...was it something to do with PHP config, ZP's getUnprotectedImageURL(), htaccess, etc, etc?? No...it was a couple of specific images with spaces in their file names that I happened to be selecting occasionally as part of a test routine :~/
Comments
It sounds an interesting project. Perhaps I will build such a plugin.
Quick question, though. You said that filenames with a space in them caused you some difficulties? That would be an unfortunate thing as spaces are really quite acceptable as characters in a filename.
Specifically, I've narrowed down a problem with PHP's imagecreatefromjpeg() where it dies with an unrecoverable error when I pass a file name with a space in it.
What I'm working on is a postcard hack which passes a handful of elements (background, stamp, a short message, font, and the image) to a script that compiles everything into a jpeg (imagecopymerge()) and sends it to a recipient.
Since it seems that imagecreatefromjpeg() is so finicky to begin with, and I have hang-ups with weird file naming from my old unix admin days, it seemed all the more reason to think about a cleanup util. This, I'm sure, is a corner-case scenario as ZP has no apparent fundamental problem with any file naming I've thrown at it. It's probably best to account for this pre-upload unless there is some other reason/use case in which you see this type of utility as a worthwhile endeavor.
It will be in the development release after the 1.4.0 build is cut. You can give it a try then and we will see if it needs tweaking.
It makes use of the SEO filter, so to change what it does to filenames you will need to change that filter. (Seemed reasonalable since that is what the back-end upload uses.)
Must be something more that files with spaces in them. That function is used to process any image. Certainly i (had) a lot of images with spaces and never had a failure to render.
The one thing I have noticed is that there is strange behavior when creating an image with some characters in the folder name. I don't remember the specifics, but there is a work-a-round somewhere in ZP that first creates the folder then creates the image when caching an image. You also get strange folders created as a side effect of this. We leave them as we never know when they will pop up.
So far I have seen this only on names with diacritical marks. But who knows, maybe there are other instances.
Anyway, thanks for the post. It was interesting to make this utility. Should be available in a few days.
I can't help thinking that what I've run into is multi-layered, but the only consistent cause/effect I can nail down is the space-in-filename scenario. I'll keep messing with it - if I uncover some other aspect, I'll post here.
Thanks again!
Thanks again for this...very helpful!