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: Displaying thumbnails with POTD plugin outside of Coppermine  (Read 2925 times)

0 Members and 1 Guest are viewing this topic.

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60

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:

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

Code: [Select]
$array = pathinfo($picture['filename']);

$img = $array['filename'] . '.jpg';

Logged

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Logged
Pages: [1]   Go Up
 

Page created in 0.045 seconds with 20 queries.