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?
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.
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.
hi!
would be great if you could help me out with the code!
thx!
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
great work, thanks a lot!
it worked at an instance!