call thumbnail by the image's pid? call thumbnail by the image's pid?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

call thumbnail by the image's pid?

Started by grrrrr, April 30, 2007, 03:16:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

grrrrr

hi!
i am  displaying my last copeprmine comments in an centered block with this selfwritten script:

$result = mysql_query("SELECT * FROM `coppermine_comments`
ORDER BY `msg_date` DESC
LIMIT 0 , 5" )
    or die(mysql_error());

while($row = mysql_fetch_array($result))
{
  echo ''.$row[2].' : <b><a href= "http://mydomain.com/coppermine/displayimage.php?pos=-'.$row[0].'">'.$row[3].'</a></b><br>';

}


this works great, but:
how could i get the specific thumbnail to the comment?

i have the pid (which is $row {0}) but i don't see a possibility to call a thumbnail from coppermine by the image's pid.
any suggestions?

grrrrr

Quote from: grrrrr on April 30, 2007, 03:16:12 PM
hi!
i am  displaying my last copeprmine comments in an centered block with this selfwritten script:

$result = mysql_query("SELECT * FROM `coppermine_comments`
ORDER BY `msg_date` DESC
LIMIT 0 , 5" )
    or die(mysql_error());

while($row = mysql_fetch_array($result))
{
  echo ''.$row[2].' : <b><a href= "http://mydomain.com/coppermine/displayimage.php?pos=-'.$row[0].'">'.$row[3].'</a></b><br>';

}


this works great, but:
how could i get the specific thumbnail to the comment?

i have the pid (which is $row {0}) but i don't see a possibility to call a thumbnail from coppermine by the image's pid.
any suggestions?

forgot to say, the comments are displayed in a smf forum with tinyportal installed.

Nibbler

Try using cpmFetch for this sort of thing. Otherwise you should join the pictures table to the comments table in the query. That will give you the file name and path. If you want to do that I can write the code.

grrrrr

hi!

would be great if you could help me out with the code!
thx!

Nibbler

#4
Something like this:


$result = mysql_query("SELECT p.pid, msg_author, msg_body, filepath, filename
FROM coppermine_comments AS c
INNER JOIN coppermine_pictures AS p ON p.pid = c.pid
ORDER BY msg_id DESC
LIMIT 0 , 5") or die(mysql_error());

while($row = mysql_fetch_assoc($result)){

echo <<< EOT

<a href="http://mydomain.com/coppermine/displayimage.php?pos=-{$row['pid']}">
<img src="http://mydomain.com/coppermine/albums/{$row['filepath']}thumb_{$row['filename']}" alt="" />
</a>
<p>{$row['msg_author']}: <span style="font-weight: bold">{$row['msg_body']}</span></p>

EOT;

}


Edit: typo in code

grrrrr

great work, thanks a lot!

it worked at an instance!