id instead of the name in url

Hi!

I have the same address: site.com/?album=XXX&image=YYY.png
Where YYY.png - the name of the file.
How to make a file name instead of the ID of this image?

Comments

  • acrylian Administrator, Developer
    How to make a file name instead of the ID of this image?
    You mean vice versa according to your topic title as this is what you have. Anyway, it is not possible.

    Besides the url example is a non modrewrite link which is not really nice anyway.
  • Yes, I was wrong.

    A friend asked me to help him with that. He says for him it is very important.
    Help please.
  • acrylian Administrator, Developer
    It is not possible to use an id in the url. Zenphoto is file system based and requires the file name.
  • You can actually make a "tiny" url to the image by using the proper functions if that is what you mean. But maybe you just want a user friendly URL such as `site.com/XXX/YYY`. If so you need to be using `mod_rewrite`. There is an option for that, but maybe since it is apparently not set your server does not support it. (BTW, the "tiny" urls will not work without `mod_rewrite` either.)
  • I wanna make page of picture: http://site.com/album/image.jpg, where image.png - field to select from db, and i wanna replace it to ID: http://site.com/album/1
  • acrylian Administrator, Developer
    Sorry, not possible, not the way Zenphoto works. See above.
  • Not possible is of course meant as not without some programming work. It would be possible to filter the URL via a plugin and turn that link into the appropriate Zenphoto parameters internally.

    But there would be some drawbacks--you could then never have an album where the name was simply digits.

    Anyway, maybe a better approach to this is to describe what you want to accomplish. The URL you originally complained about is caused by not using mod_rewrite. If you enable mod_rewrite the links look much more friendly. Is that all you need to do or is there some intrinsic reason why the link needs to be a number?

    Unless you enable mod_rewrite there is in fact no possible solution as there is no means of intervention by Zenphoto--all links must point to an actual file.

    If you really want a link that looks like `http://site.com/album name/#` and your site supports mod_rewrite, a plugin can attach to `load_request` filter and provide the mapping.
  • which file contains rewrite (mod_rewrite) to page with a picture? in zenphoto-rewrite.txt it isn't!
    for example i want to replace /{albumname}/{imagename}.{ext} to /{albumname}/images/{imagename}.{ext}
  • acrylian Administrator, Developer
    As my colleague explain it is not that simple. The urls are generally created internally and not by mod_rewrite direclty.

    As already suggested maybe explain first why you need to do this actually. I mean is the "images" really needed as naturally an album may contain those?
  • It is clear that the inside, and in what file is it?
  • I replaced filename to ID.
    But it only works without mod_rewrite: /?album={albumname}& image={imageid} - OK
    And with mod_rewrite: /{albumname}/{imageid} - FAIL
  • acrylian Administrator, Developer
    It is strongely recommended to never modify a core file unless you want the fun to do it all over again with every update.

    The proper way is creating a plugin as mentioned above.
  • If you do not take much of your time, you can write this plugin?
    In order to address the album and the name of the image replaced by the ids respectively.
    It does not take much time.
  • Please see: http://www.zenphoto.org/pages/paid-support

    I should warn you that such customization does not come cheep. So if it is worth several hundreds of dollars for this feature make a request of one of the parties on the page.
Sign In or Register to comment.