Advanced search  

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]

Pages: [1]   Go Down

Author Topic: putting together URL from database - here´s the pos= value?  (Read 3696 times)

0 Members and 1 Guest are viewing this topic.

benjamin916

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
putting together URL from database - here´s the pos= value?
« on: April 20, 2007, 03:34:46 pm »

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.
« Last Edit: April 23, 2007, 07:42:27 am by GauGau »
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: putting together URL from database - here´s the pos= value?
« Reply #1 on: April 20, 2007, 03:42:36 pm »

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

Do that first.
Logged

Nibbler

  • Guest
Re: putting together URL from database - here´s the pos= value?
« Reply #2 on: April 20, 2007, 03:48:13 pm »

Use pos=-pid
Logged

benjamin916

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: putting together URL from database - here´s the pos= value?
« Reply #3 on: April 21, 2007, 09:46:15 am »

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.

Code: [Select]
<?
$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>
Logged

Nibbler

  • Guest
Re: putting together URL from database - here´s the pos= value?
« Reply #4 on: April 21, 2007, 12:10:13 pm »

Use pos=-pid as suggested...

Code: [Select]
<a href="/fotogalerie/displayimage.php?pos=-<?= $gal_picid; ?>" target="_blank">
Logged

benjamin916

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: putting together URL from database - here´s the pos= value?
« Reply #5 on: April 22, 2007, 08:33:45 pm »

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?
Logged

Nibbler

  • Guest
Re: putting together URL from database - here´s the pos= value?
« Reply #6 on: April 22, 2007, 09:01:24 pm »

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.
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 20 queries.