ZenphotoCMS Forum
id instead of the name in url - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: id instead of the name in url (/thread-11432.html)



id instead of the name in url - aleks63 - 2013-10-25

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?




id instead of the name in url - acrylian - 2013-10-25

[i]How to make a file name instead of the ID of this image?[/i]
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.




id instead of the name in url - aleks63 - 2013-10-25

Yes, I was wrong.

A friend asked me to help him with that. He says for him it is very important.
Help please.




id instead of the name in url - acrylian - 2013-10-25

It is not possible to use an id in the url. Zenphoto is file system based and requires the file name.




id instead of the name in url - sbillard - 2013-10-25

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.)




id instead of the name in url - aleks63 - 2013-12-19

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




id instead of the name in url - acrylian - 2013-12-19

Sorry, not possible, not the way Zenphoto works. See above.




id instead of the name in url - sbillard - 2013-12-19

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.




id instead of the name in url - aleks63 - 2013-12-19

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}




id instead of the name in url - acrylian - 2013-12-19

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?




id instead of the name in url - aleks63 - 2013-12-19

It is clear that the inside, and in what file is it?




id instead of the name in url - aleks63 - 2013-12-19

I replaced filename to ID.
But it only works without mod_rewrite: /?album={albumname}& image={imageid} - OK
And with mod_rewrite: /{albumname}/{imageid} - FAIL




id instead of the name in url - acrylian - 2013-12-19

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.




id instead of the name in url - aleks63 - 2013-12-19

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.




id instead of the name in url - sbillard - 2013-12-19

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.