zenphoto forums » General Zenphoto Discussion

replace spaces with underscores in albums url

(11 posts)
  • Started 3 weeks ago by stuartmiles
  • Latest reply from acrylian
  1. stuartmiles

    Member
    Joined: Oct '16
    Posts: 17

    Hi

    Is there a way to replace the spaces in the urls with underscores. Where I have albums with more than one word there is a space (%20) in the url which is causing a problem with a place I am connecting to.

    For example http://freepixelz.com/Celebrations/Baby_Shower/bat1-05975.JPG instead of http://freepixelz.com/Celebrations/Baby%20Shower/bat1-05975.JPG

    Thanks

    Stuart

    Posted 3 weeks ago #
  2. Zenphoto development team
    acrylian

    Zenphoto team
    Joined: Jul '07
    Posts: 16,766

    The seo_zenphoto plugin if enabled will clean album folder names and filenames if created respectively uploaded via the backend for standard ASCII chars which includes replacing spaces with dashes. Underscores are not replaced though as they are fine already.

    The seo_cleanup plugin allows doing this cleaning afterwards but since it uses above plugin underscores are not changed. You would have to create your own plugin version to change that.

    Don't forget to read the Forum rules and usage resources
    Posted 3 weeks ago #
  3. stuartmiles

    Member
    Joined: Oct '16
    Posts: 17

    Dashes is fine. I'll try that.

    If no more message it means it worked....

    Many thanks!

    Posted 3 weeks ago #
  4. stuartmiles

    Member
    Joined: Oct '16
    Posts: 17

    Hi acrylian

    That worked fine on my test site but on my main site it failed, maybe due to timeout as I have 35,000 images.

    My image names are fine as they don't have spaces so it is only the albums that I need to fix so looks like I have to do it on the database.

    I see there is a field called 'folder' in the the 'albums' table which will need changing but is there anything else? how about the htaccess file or zenphoto-rewrite.txt file?

    Thanks for your help.

    Stuart

    Posted 2 weeks ago #
  5. stuartmiles

    Member
    Joined: Oct '16
    Posts: 17

    I tried changing one of the album records in the database from 'outer space' to 'outer-space' and after looking at the pages in the browser the database changed back to 'outer space' so I take it there must be something else to do.

    Posted 2 weeks ago #
  6. Zenphoto development team
    fretzl

    Zenphoto team
    Joined: Sep '08
    Posts: 1,096

    Since Zenphoto is file system based you can't use the database to change (physical) file/folder names on the server.

    If you want to do this only once you could try to temporarily edit the file zp-core/zp-extensions/seo_cleanup.php

    Comment(or remove) lines 109-133.
    This causes only albums/subalbums to be processed and maybe then the server won't timeout.
    Be sure to revert to the original zp-core/zp-extensions/seo_cleanup.php file afterwards.

    You may still get a warning on the backend that the file has been changed. If so, run setup again.

    Don't forget to read the Forum rules and usage resources
    Posted 2 weeks ago #
  7. Zenphoto development team
    acrylian

    Zenphoto team
    Joined: Jul '07
    Posts: 16,766

    @stuartmiles: Might have been a time out but you should look into your server PHP error log to be sure about that. It also could be a file/folder permissions issue or something else.

    We'll take a look to add a plugin option so you can at least choose to clean images and/or albums.

    Don't forget to read the Forum rules and usage resources
    Posted 2 weeks ago #
  8. stuartmiles

    Member
    Joined: Oct '16
    Posts: 17

    Hi fretzl and acrylian

    I started making copies of the folders then adding hyphens and just changing the album titles but the hosting went down so I quit for the day...

    I have decided to change to cloud hosting and will have to upload everything again so I think I will add hyphens to the folders before uploading which should be easier to sort out.

    I will still keep the hosting as a backup so will try running the cleanup file with those lines commented out.

    Thanks again for all of your help :-)

    Posted 2 weeks ago #
  9. Zenphoto development team
    acrylian

    Zenphoto team
    Joined: Jul '07
    Posts: 16,766

    Note if you change the folder names without using those backend tools you might loose album data.

    If you for example entered titles, descriptions, added tags etc. after uploading those albums all will be gone as a new folder name means new album (same for images). Zenphoto matches the database to the file system not the other way round.

    If that is not a problem for you then fine of course.

    Don't forget to read the Forum rules and usage resources
    Posted 2 weeks ago #
  10. stuartmiles

    Member
    Joined: Oct '16
    Posts: 17

    I was duplicating the folder and adding dashes so it was treating it as a new album then I deleted the old so it worked out ok.

    Thanks

    Stuart

    Posted 2 weeks ago #
  11. Zenphoto development team
    acrylian

    Zenphoto team
    Joined: Jul '07
    Posts: 16,766

    Okay, just that step wouldn't have been necessary as changing the folder name on the file sytems means new album for Zenphoto already. The only possible issue is data entered via the backend afterwards as that would get lost this way in any case.

    Don't forget to read the Forum rules and usage resources
    Posted 2 weeks ago #

RSS feed for this topic

Reply

You must log in to post.