I'm not sure where to start with that I'm afraid.
Offline
depends on what are you tring to do ?
insert some images from Piwigo in some Wordpress post? Or showing the latest pictures from Piwigo into Wordpress sidebar?
try to save this as test.html on your webserver, then access in your browser.
<!DOCTYPE html> <html> <head> <script type="text/javascript"> var p_api = 'http://yarnwhispering.co.uk/pix/ws.php?format=json&method=pwg.images.getInfo&image_id=40'; //piwigo web api location var request = new XMLHttpRequest(); request.open('GET', p_api, true); request.onload = function() { if (request.status >= 200 && request.status < 400) { var mydata = JSON.parse(request.responseText); alert(JSON.stringify(mydata, null, ' ')); //do something with the data } }; request.send(); </script> </head> <body> </body> </html>
if you see an alert box with data info from that image then it's working.
Offline
No alert I'm afraid:-
http://www.yarnwhispering.co.uk/testloop3.php
Mind this doesn't work if I run it form my local machine either.
Offline
try http://yarnwhispering.co.uk/testloop3.php
:)
@edit: to make it work also with www try to enable cors in your htaccess file your host allow this kind of config
http://enable-cors.org/server_apache.html
or put www to this
var p_api = 'http://yarnwhispering.co.uk/pix/ws.php?format=json&method=pwg.images.getInfo&image_id=40'; //piwigo web api location
I already asked Piwigo developers to enable cors for the json output
http://piwigo.org/forum/viewtopic.php?p … 84#p165084
Last edited by eliz82 (2017-01-22 23:27:23)
Offline
Well that works making the .htaccess change. So with your help I've established that PHP code amendments to the plugin aren't going to work. That the only way of integrating Piwigo with WordPress on the same server is using JS.
Clearly replicating the plugin features is a major task and well beyond me. However with your help I do have a way, with a bit of amateur hacking, of getting some things to work.
@eliz82 many many thanks for all the help you've offered, I am really grateful. Its just a shame that the plugin author wasn't equally interested in establishing why his code wasn't working. I'm hoping that as a minimum I can persuade him to amend the plugin description to highlight the shortcoming to save others in the future expending so much energy on a blind alley.
Offline
I am happy about technical advice or pull request to fix this problem. I just didn't have the time to try to track something down that does not happen nor on my test server nor on my real server.
The code is all in github, pull requests are greatly appreciated.
Norbert
Offline
That's great @norbusan, is this something you could fix then? Not being an expert in this I do not understand what is meant by "pull requests".
Offline