Displaying thumbnails with POTD plugin outside of Coppermine Displaying thumbnails with POTD plugin outside of Coppermine
 

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

Displaying thumbnails with POTD plugin outside of Coppermine

Started by wipqozn1, May 08, 2007, 01:26:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wipqozn1

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';