#1 2019-08-02 19:10:18

JohnB
Member
2019-08-02
16

Running a search through a URL

I would like to access the search results for my piwigo through a direct URL. So after I've tagged photos as "Fred Bloggs", I can access the list of them from a mediawiki site using an URL like http://piwigo.johnb.com/search?keywords=Fred_Bloggs

Is this possible? I'm able to control how spaces are handled using .htaccess rules, but generally the search string will be automatically generated from the mediawiki page title.

Thanks

John

Piwigo version: 2.9.5
PHP version: 7.1
MySQL version: ?
Piwigo URL: http://

Offline

 

#2 2019-08-02 23:49:34

erAck
Only trying to help
2015-09-06
2236

Re: Running a search through a URL

You could do with the Piwigo web services API method pwg.tags.getImages and some after-processing of the result, for example
...://piwigo.johnb.com/ws.php?format=rest&method=pwg.tags.getImages&tag_name=Fred_Bloggs
Play with it at your ...://piwigo.johnb.com/tools/ws.htm

If instead you want to display a gallery page with the result (not quite clear from your question) then it's simply
...://piwigo.johnb.com/index/tags/Fred_Bloggs
Note that the actual URI may differ, this clear style is the result of

Code:

$conf['question_mark_in_urls'] = false;
$conf['php_extension_in_urls'] = false;
$conf['tag_url_style'] = 'tag';

in piwigo/local/config/config.inc.php
Read the documentation for each in piwigo/include/config_default.inc.php


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2019-08-03 10:12:19

JohnB
Member
2019-08-02
16

Re: Running a search through a URL

Thanks for the index/tags, stuff, that may do what I want. I am coming across an anomaly though

From the tags in the side-bar I see there is an entry for "Fred Bloggs" which resolves to
http://www.piwigo.fancy-test.com/index. … red_bloggs
when I edit that to
http://www.piwigo.fancy-test.com/index. … red_bloggs
it works, but when I edit again to
http://www.piwigo.fancy-test.com/index. … red_Bloggs
it doesn't, but
http://www.piwigo.fancy-test.com/index. … red_Bloggs
does work

Something odd is going with the case checking, and I don't want to have to know the tag number when referencing externally. Can I subvert tags like this, or do I need to return to search.

I don't want to have to massage the pwg.tags.getImages results, a gallery like what tags returns is fine.

Last edited by JohnB (2019-08-03 10:13:12)

Offline

 

#4 2019-08-03 11:30:11

erAck
Only trying to help
2015-09-06
2236

Re: Running a search through a URL

Ah true, tags in URL are lower case sensitive, if it's $conf['tag_url_style'] = 'id-tag' then the identifying part seems to be the ID so it works in any case.

You could add some ugly rewrite rules in .htaccess or use mod_spelling or rather a RewriteMap for the /tags/.*[A-Z] case in httpd.conf, see https://www.askapache.com/htaccess/rewr … lowercase/


Running Piwigo at https://erack.net/gallery/

Offline

 

#5 2019-08-05 11:34:16

JohnB
Member
2019-08-02
16

Re: Running a search through a URL

Success with the .htaccess changes, but note that I could not use the rewrite rules most commonly posted on the web, I had to use the one in https://stackoverflow.com/questions/467 … ccess-only as I was hitting the maximum length error mentioned

Offline

 

#6 2019-08-06 15:30:53

JohnB
Member
2019-08-02
16

Re: Running a search through a URL

While I now have simple external access to tags, I don't have it for albums, so my album "Picocon 14" is found at

http://www.piwigo2.fancy-test.com/index.php/category/5

while I'd like to to be at

http://www.piwigo2.fancy-test.com/index … Picocon_14

Offline

 

#7 2019-08-06 15:45:04

JohnB
Member
2019-08-02
16

Re: Running a search through a URL

Aha, using the permalinks plugin, and adding to htaccess in extension to what I already had

RewriteRule ^/?(.*)\ (.*)$ $1-$2 [L]

http://www.piwigo2.fancy-test.com/index … ry/Picocon 14

works

The plugin did give a php warning, which I ignored

Offline

 

Board footer

Powered by FluxBB