TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 728
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 384
  • Total: 384

Random photos from coppermine

Started by carver, September 22, 2005, 01:32:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ynohtna

wooo you have a nice little write up for that?  I've seen some writeups to integrate gallery right into SMF... but I kinda got lost in it all.  Is this gallery intergrated to TP or SMF or ?? :)

Ray

I use gallery and have it in smf as a block
www.rranderson.com

agridoc

I use a script by kegobeer with more options (I haven' t tried CMPfetch)
http://www.simplemachines.org/community/index.php?topic=16538.0 or
http://pictures.kazebeer.com/coppermine/displayimage.php?album=6&pos=0
It adds a function in SSI with parameters.
QuoteÂÃ,  ##ÂÃ,  When calling this function, there are four variables you can set.
ÂÃ,  ##ÂÃ,  The number of pictures to display, last updated/random images,
ÂÃ,  ##ÂÃ,  where the Coppermine directory is (relative to where the file
ÂÃ,  ##ÂÃ,  that's calling this function, and the output method.

You can use it in many ways with SMF and TP.

JaxDoux, CPG can be easily integrated into TP with the plus of very easy collapse of the side blocks without leaving TP. This last is important if someone has big photos. As I am testing TP in my PC, to the moment I see my CPG gallery (in my server) in an article with IFRAME (in my PC).

Impressive result Ray but I think the gallery it is not CPG.
  For Greek aeromodellers and our friends around the world  - Greek Button sets for SMF

Ray

QuoteImpressive result Ray but I think the gallery it is not CPG.

No it is not yet - I just wanted to show how it can look ;D and I like gallery a lot

snork13

looks interesting ray, i did the same with coppermine.

www.snork13.net

crip

What kind of Portal is it?
Looks good..will BlackChrome be TP ready?

crip


crip

Quotefunction ssi_CoppermineImages($num_pics = 5, $order = 'lastup', $wherescoppermine = 'coppermine/', $output_method = 'echo')
{
  ##  When calling this function, there are four variables you can set.
  ##  The number of pictures to display, last updated/random images,
  ##  where the Coppermine directory is (relative to where the file
  ##  that's calling this function, and the output method.
  ##
  ##  Default values are 5, 'lastup', 'coppermine/', 'echo'
  ##  If you need to skip a default value, use null.  For example, (null, 'random') displays 5 random
  ##  images.
  ##
  ##  The variable $wherescoppermine depends on where you are calling ssi_CoppermineImages from.
  ##  For example, my directory structure is like this:  root -> coppermine
  ##                                                     root -> smf
  ##  If I call ssi_Coppermine from a file located in root, the variable would be coppermine/
  ##
  ##  Here are a few examples:
  ##  To display 10 random images, you'd call: ssi_CoppermineImages(10, 'random');
  ##  To get the last 5 updated images into an array, you'd call: ssi_CoppermineImages(null,null,null,'return');

  if (is_null($wherescoppermine)) $wherescoppermine = 'coppermine/';
  if (is_null($order)) $order = 'lastup';
  if (is_null($num_pics)) $num_pics = 5;
  if (is_null($output_method)) $output_method = 'echo';

  $cpgtable = 'cpg132_';  // Change to your Coppermine table prefix
  $titlelen = 15; // Maximum number of letters displayed under the pictures

  $return = array();
  $cpgConfig = array();

  $result55 = db_query("
    SELECT extension, mime, content
    FROM {$cpgtable}filetypes", __FILE__, __LINE__);
  while ($row = mysql_fetch_array($result55))
    $file_types[$row['extension']] = $row;
  mysql_free_result($result55);

  $temp55 = db_query("
    SELECT *
    FROM {$cpgtable}pictures
    WHERE approved='YES'", __FILE__, __LINE__);
  $return['pic_total'] = mysql_num_rows($temp55);
  mysql_free_result($temp55);

  $temp55 = db_query("
  SELECT *
  FROM {$cpgtable}albums", __FILE__, __LINE__);
  $return['alb_total'] = mysql_num_rows($temp55);
  mysql_free_result($temp55);

  $temp55 = db_query("
    SELECT * FROM {$cpgtable}config", __FILE__, __LINE__); 
  while ($row55 = mysql_fetch_array($temp55))
  $cpgConfig[$row55['name']] = $row55['value'];
  mysql_free_result($temp55);

  $fullpath = $cpgConfig['fullpath'];
  $cpgpath = $cpgConfig['ecards_more_pic_target'];

  if ($order == 'lastup')
    $orderby = 'pid';
  else
    $orderby = 'RAND()';
   
  $request5 = db_query("
    SELECT pid, filepath, filename, filesize, title, aid
    FROM {$cpgtable}pictures
    WHERE approved='YES'
    ORDER BY $orderby DESC
    LIMIT $num_pics", __FILE__, __LINE__);

  $imagecounter = 0;
  $return['pictures'] = array();
  while ($row5=mysql_fetch_array($request5))
  {
    $imagecounter++;
    $filename = $row5['filename'];
    if (!is_array($filename))
      $filename = explode('.',$filename);
    $EOA = count($filename)-1;
    $filename[$EOA] = strtolower($filename[$EOA]);
    $mime_content = $file_types[$filename[$EOA]];

    $filepathname = null;
    $custom_thumb = null;
    $custom_thumb_path = $wherescoppermine.$fullpath.$row5['filepath'].'thumb_';

    if ($mime_content['content'] != 'image')
    {
      $thumb_extensions = Array('.gif','.png','.jpg');
      $file_base_name = str_replace('.'.$mime_content['extension'],'',basename($row5['filename']));
      foreach ($thumb_extensions as $extension)
      {
        if (file_exists($custom_thumb_path.$file_base_name.$extension))
        {
          $filepathname = $custom_thumb_path.$file_base_name.$extension;
          $custom_thumb = 1;
          break;
        }
      }
      if (is_null($filepathname))
      {
        foreach ($thumb_extensions as $extension)
        {
          if (file_exists($wherescoppermine.'images/thumb_'.$mime_content['extension'].$extension))
          {
            $filepathname = $wherescoppermine.'images/thumb_'.$mime_content['extension'].$extension;
            break;
          }
        }
      }
    }
    else
    {
      $filepathname = $custom_thumb_path.$row5['filename'];
    }
    if ($orderby == 'pid')
      $display = 'lastup&&cat=0&pos='.($imagecounter-1);
    else
      $display = 'random&&cat=0&pos=-'.$row5['pid'];

    $return['pictures'][] = array(
      'imagelnk' => $wherescoppermine.'displayimage.php?album='.$display,
      'imageurl' => $filepathname,
      'imagetitle' => (strlen($row5['title']) > $titlelen ? substr($row5['title'],0,$titlelen).'...' : $row5['title']) . ($mime_content['content'] != 'image' ? ($custom_thumb == 1 ? ($row5['title'] != '' ? '
' : '').'('.$mime_content['content'].', '.round($row5['filesize']/1024).'K)' : '
('.round($row5['filesize']/1024).'K)') : '')
    );
  }
  mysql_free_result($request5);
  if ($output_method == 'echo')
  {
    foreach($return['pictures'] as $pictures)
    {
      echo '
        <div class="div" style="float: left; width: 150px; height: 130px; text-align: center;">
        <a href="' . $pictures['imagelnk'] . '">
        <img src="' . $pictures['imageurl'] . '" height="100" width="100" border="0" alt="" /></a>

        <span style="font-size: x-small">'.$pictures['imagetitle'].'</span></div>';
    }
    echo '
     
<div style="clear: both;"></div>
      <span>The Gallery has ' . $return['pic_total'] . ' files in ' . $return['alb_total'] . ' albums.  You should go <a href="'.$wherescoppermine.'index.php">see</a> them!</span>';
  }
  else
  {
    return $return;
  }
}

So how do I make this work..in TP or a page by itself?...can you tell more more on how-to?
crip~

snork13

you would have to call the correct path for the ssi_CoppermineImages file on your server, or ssi file on your server if it's not seperate

crip

I been thinking how I could use [cftest.php] file/page and use the Random Images it displays?

I'd remove everything on that page/file - phpinfo - test..et-ceteras, and leave only the part that
shows the Random image?..is this possible?

* Input please*, I have read and tried everything here; and @ FistFullOfCode also..

Later, Crip~ ;D

This website is proudly hosted on Crocweb Cloud Website Hosting.