[solved] How to get a list of G2 image URL's? Like external Image block but only the URL
|
dreamingof8a
Joined: 2005-05-22
Posts: 69 |
Posted: Tue, 2009-07-21 12:41
|
|
Hi there, for my G2 integration I could really do with a simple list of URL's of one or more images of my Gallery 2. <images> So basically http://url.to.gallery/album1/test1.jpg are random URL's taken from my gallery. Of course it would actually be sufficient to be able to retrieve the simple "random picture url" and process it with PHP to be put in above format. I could archieve that by using the @readfile(external image block) thing and then use a lot of PHP to filter the URL - but maybe there is an easier way?? Cheers Felix |
|

Posts: 7892
Look to the mediaRss.php which comes with my minislideshow and/or mediaBlock.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 69
Thanks, I'll look into it
Posts: 69
Actually I solved it now the way I first thought - thanks anyway for your help, yours is probably the cleaner solution.
If anyone is interested, that's the code I use:
<?php $code = file_get_contents('http://gallery.felixsalomon.net/main.php?g2_view=imageblock.External&g2_blocks=randomImage|randomImage|randomImage|randomImage&g2_show=none&g2_maxSize=60& g2_itemFrame=none'); $regex = '=^(.*)(<img|<image)(.*)src\="?(\S+)"([^>]*)>(.*)$=msi'; $xml = '<images>'. "\r\n"; $i=0; while (preg_match($regex, $code, $finds)) { $xml .= '<image href="' . dirname( $finds[4] ) . '">' . basename( $finds[4] ) . '</image>' . "\r\n" ; $code = $finds[1]; } $xml .= '</images>'; $file = fopen("file.xml", "w"); fwrite($file, $xml); fclose($file); ?>It gives me a file which contains a simple xml list:
Cheers
Felix