putting together URL from database - here´s the pos= value? putting together URL from database - here´s the pos= value?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

putting together URL from database - here´s the pos= value?

Started by benjamin916, April 20, 2007, 03:34:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

benjamin916

Dear forum users,

I am running cpg1.49. I am trying to put together an image feed to an external website, which is working so far.

I am using the data stored in the cpg mysql database in order to build the image path.

Now I would like to make the image clickable.

Therefore I´d like to know, where coppermine stores the URL value &pos=xxx (taken from the URL: http://www.powerwheelie.de/fotogalerie/displayimage.php?album=16&pos=1498)

Am I able to find this value in the database as well?

I tried searching the whole forum for a while, but couldn´t find a proper answer.
Thank you for your time.

Hein Traag

QuoteI am running cpg1.49
It's mandatory to upgrade to 1.4.10

Do that first.


benjamin916

Quote from: Nibbler on April 20, 2007, 03:48:13 PM
Use pos=-pid

Doesn´t work mate :(

Look here, on the right hand side, there´s a random gallery image.
http://www.powerwheelie.de/

If you click on it, the link guides you to another image.

<?
$query ="SELECT
*
FROM
cpg149_pictures
ORDER BY
RAND()
LIMIT 1
";
$result = mysql_query($query) or die(mysql_error());
$getEntry = mysql_fetch_assoc($result);

global $galeriebild;
$galeriebild = $getEntry['filepath'] . $getEntry['filename'];

global $gal_album;
$gal_album = $getEntry['aid'];

global $gal_picid;
$gal_picid = $getEntry['pid'];
?>

<a href="/fotogalerie/displayimage.php?album=<?= $gal_album; ?>&pos=<?= $gal_picid; ?>" target="_blank"><img class="galeriebild" src="/fotogalerie/albums/<?= $galeriebild; ?>" width="150" alt="Galeriebild" style="border: 1px solid #000000;"></a>

Nibbler

Use pos=-pid as suggested...

<a href="/fotogalerie/displayimage.php?pos=-<?= $gal_picid; ?>" target="_blank">

benjamin916

Superb,

thanks a lot mate. That does work.

Just a final question. How come I can´t manage to use CPG´s original url structure as displayed above, including album=xxx&pos=xxx .

Just wondering?

Nibbler

pos is the position of the file in the album based on the current sorting method. You can't get that reliably from outside Coppermine.