Translating spaces in directories to URLs

Hi. New ZP user but big fan. Very impressed with the product and tireless developers. Already have my list of tweaks to do, so I hope to be a more active member.

So easiest question for the first post: Album name spaces translating to "%20" quickly make for a long ugly URL. I searched how to at least shrink this to ONE char. I was intrigued how spaces in filenames turned to "+", but spaces in album names turned to "%20". I tracked it down to the use of "rawurlencode" (in pathurlencode()) vs "urlencode". So I tried changing pathurlencode() to use "urlencode". This seem to cause most of my thumbnail images to show broken links.

So my question is: Is this worthwhile to track down and fix? Do you know why this might break some things? Or does using "+" in URLs instead of "%20" just a bad idea.

Using:
Zenphoto version 1.2.6 [4335] (Official Build)
PHP version: 5.2.10
Graphics support: PHP GD library bundled (2.0.34 compatible)
MySQL version: 5.0.77
Apache 2.2.11_4 (mod_rewrite turned on)

Comments

  • acrylian Administrator, Developer
    If you upload or create albums via the admin backend spaces are turned into "-" (using the SEO filter plugin). If you upload via ftp and name folders manually they are not touched as they are not created by Zenphoto.

    So if you upload via ftp you should name your files and folders using underscores or "-" instead of spaces first place. Also remember the album folder name/image file name is independed from the title you can set on the backend!

    This is actually no issue.
  • But if you wish to change this you should know that Zenphoto uses URL encoding provided by PHP which also needs to be supported by browsers. So, when an URL contains %20 in place of a space, the actual string that Zenphoto sees is the space, not the $20. Anything not following this pattern would require new handling functions throughout Zenphoto to do the to/from translations. This change is likely to be problematic as for sure you will miss some place that needs to be changed an thus will introduce a latent problem into the scripts. We developers have not considered the benifits of such a change worth the risks.
  • Malte: Yes, this is not an issue. This should have been entered as a feature/enhancement/tweak/other.

    I should have described my use case better:
    I run ZP on a server (FreeNAS) in my office. As such, I can create a Windows share of the albums folder. Result: Super easy Windows explorer drag-drop picture sharing & album creation for my wife (and me) without bring up the admin web page.

    Stephen: I tried to track down the use of '+' as an alias for 'space' in URLs, and it looks a little too iffy for me. Seems like '+' in place of a 'space' should only be allowed in a query (after the first '?'). But browsers seem to support (by accident?) translating '+' as a 'space' when typed into the address bar or used in a link.

    Anyway, I think I found an acceptable solution for my needs:
    - Disallow use of space in the directory/album name (they are ignored just like ".dirname")
    - When a directory is found, translate all '_' to 'space' for the album title.

    Therefore:
    - A little extra work changing 'space' to '_' for all directory names
    - URLs use one char to separate words
    - Album names use words and spaces correctly.
Sign In or Register to comment.