forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 plugins => Topic started by: wipqozn1 on May 08, 2007, 01:26:05 pm
-
Useful solution for displaying thumbs for files with different extensions while using POTD plugin.
I reffer to this topic where the problem is presented in details.
Solution:
$content = '';
{
$query = <<< EOT
SELECT p.pid, aid, filepath, filename, owner_name, owner_id
FROM {$CONFIG['TABLE_PLUGIN_POTD']} AS pp LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p
ON p.pid=pp.pid
WHERE pp.potw='1'
EOT;
$result = cpg_db_query($query, $dbi); // aid numbers can be changed as need to respect permissions
$picture = mysql_fetch_array($result);
$picture['filename'] = substr($picture['filename'], 0, -3) . 'jpg';
$img = "<img src=\"http://gryz.pl/albums/userpics/thumb_{$picture['filename']}\" border=\"0\">";
$content .= <<< EOT
<table width="378px" height="410px" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="center"><a href="{$CONFIG['path_to']}displayimage.php?pos=-{$picture['pid']}" target="new">$img</a><br />
<br />
<big>{$lang_meta_album_names['potw']}</big><br />
<small>{$lang_meta_album_names['by']}</small>
<br />
</td>
</tr>
</table>
EOT;
$stop++;
}
This will show thumbnails for .swf files on POTD pages.
If we have PHP 5.2 on our server we also could use pathinfo() like this:
$array = pathinfo($picture['filename']);
$img = $array['filename'] . '.jpg';
-
Sorry, the topic I refer is: http://forum.coppermine-gallery.net/index.php?topic=43599