forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: rphMedia on November 18, 2004, 09:50:37 pm

Title: Image paths in the database
Post by: rphMedia on November 18, 2004, 09:50:37 pm
Hi,

I'm trying to go into Coppermine database and pull out the (user) image paths.  I got a hack from one of the users here and am just trying to modify it a little to output image paths.  I'm close but I can't seem to get the exact path output.  I can can get "either one of them", but I can't seem to get them tied together (don't know enough about how to do it actually). The goal is to list on a page, all of the normal_ sized images.  Eventually, I will just select a few, either random or whatever, but if someone could give me a head start here, I'd appreciate it.  It has nothing to do with displayimage.php, that's why I'm here in the Misc section.  Here's what I have so far, it's probably ugly to you and remember, it doesn't work perfect right now.


<?php
define('IN_COPPERMINE', true);

require('include/init.inc.php');
pageheader(Welcome);

// Select all photos
$result = mysql_query("SELECT a.pid, a.aid, a.filename, a.filepath, b.title atitle from {$CONFIG['TABLE_PICTURES']} a, {$CONFIG['TABLE_ALBUMS']} b where a.aid = b.aid order by a.aid, a.pid desc");
if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap']);

$p_aid = -1 ;
// Result to table
starttable("100%", Welcome, 3);
   while ($row = mysql_fetch_array($result))
        {
                if ($row[aid] != $p_aid) {
           }
            // I would like this output to be a "graphical" array of the images using "filepath" somehow
            echo "<tr><td><img src =\"$row[filepath]\" title=\"$row[filename]\">$row[filename]</td></tr>";
       $p_aid = $row[aid] ;
    } ; // while
               
endtable();
pagefooter();
?>

I'd like the output to be something like this -

albums/userpics/10006/image1.jpg
albums/userpics/10006/image2.jpg
albums/userpics/10007/image1.jpg
etc....you get the idea.

This is what it gives me so far (attached).  I think I'm pretty close here, but just need a little guidance, thanks!






[attachment deleted by admin]
Title: Re: Image paths in the database
Post by: Nibbler on November 18, 2004, 10:39:21 pm
You need to add 'albums/' to the start of the pic links, preferably using $CONFIG['fullpath'].
Title: Re: Image paths in the database
Post by: rphMedia on November 19, 2004, 01:05:49 am
DOH, that did the trick, thanks!