Advanced search  

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

Pages: [1]   Go Down

Author Topic: Displaying thumbnails with POTD plugin outside of Coppermine  (Read 3472 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.023 seconds with 19 queries.