DownloadItem by path?
nrutman
Joined: 2005-12-05
Posts: 6 |
Posted: Fri, 2005-12-09 01:56 |
Is it possible to use the DownloadItem by path? t seems to really want an itemId, which there's no easy way of figuring out afaik. This works: |
|
Posts: 8601
did you try using %path% in URL rewrite site admin? it might work, not sure..
Posts: 6
Doesn't work, the DownloadItem script seems to demand an itemId or it returns an error.
Posts: 32509
just use the default download item rule, which includes the id and the path
resulting in /d/id-serial/path URLs
Posts: 6
The point is that I don't know the id#, all I know is the filename.
Say joe user sees a picture they want at
http://www.rutmans.org/gallery/beams/DSCF0049.JPG.html
All they know is the filename, not what internal id that Gallery has assigned to it.
They want to download this picture, I want them to be able to type
http://www.rutmans.org/gallery/beams/DSCF0049.JPG
and get the downloadItem for that path (I suppose the largest available version of the image).
Does that make sense? Is there a completely different way to do this that I'm not seeing?
Posts: 32509
if you only have the filename, you can't call g2 directly.
you'll have to call GalleryCoreApi::fetchItemIdByPath($path);
Posts: 8601
there's a module in user contrib (click documentation in upper right, then find user contrib) to show you the urls for an item. you can also just use the path.html url, then right click on the image to copy its url. you could also compare the code for showitem rule and download rule in modules/rewrite/module.inc and see if it might be easy to allow %path% in the download rule.