Similar image - Page 2 Similar image - Page 2
 

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

Similar image

Started by serg5777, August 23, 2013, 08:01:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

serg5777

Andre, I did not design the main thing, the main thing in the filmstrip to display similar images (from the album), just could not find plugin.
This is just to say one of the embodiments of similar images for the gallery :)

serg5777

Andre perhaps you I still do not understand, I will show you the screenshot below:

serg5777

Only the images in the filmstrip were not in a row, and were spread out on the album.

Αndré

#23
Here's a quick draft. Copy the function theme_display_image from themes/sample/theme.php to your theme's theme.php file, if it doesn't exist. Then, find
    starttable();
    echo $picture;
    endtable();

and below, add
    // Display random pictures from the same album
    if ($superCage->get->testInt('cat')) {
        $album = abs($superCage->get->getInt('cat'));
    } elseif ($superCage->get->testInt('album')) {
        $album = $superCage->get->getInt('album');
    } else {
        $album = mysql_result(cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = ".$superCage->get->getInt('pid')), 0);
    }
    global $RESTRICTEDWHERE;
    $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS r INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid $RESTRICTEDWHERE AND pid != ".$superCage->get->getInt('pid')." AND r.aid = $album AND approved = 'YES' ORDER BY RAND() LIMIT 4");
    if (mysql_num_rows($result)) {
        starttable(-1, 'Similar pictures');
        echo '<tr width="100%">';
        while ($row = mysql_fetch_assoc($result)) {
            $pic_url = get_pic_url($row, 'thumb');
            echo "<td class=\"thumbnails\" align=\"center\"><a href=\"displayimage.php?pid={$row['pid']}#top_display_media\"><img class=\"image\" src=\"$pic_url\" /></a></td>";
        }
       
        endtable();
    }
    mysql_free_result($result);

serg5777

Many thanks to Andre, you do great work!
Do not tell me how to add a field to tableh1 similar photos?

Αndré

From your screenshot I assume you want to move the similar pictures down. But I don't understand what you actually asked.

serg5777

To have similar picture was the same as that of a brown field and voting info :)

Αndré

Ah, you want to add a table header :D

Replace
starttable();
with something like
starttable(-1, 'Similar pictures');

serg5777

All is fine, for a new version of the gallery is the CPG will be a nice addition;)
I'm sorry for my english) Thanks again!

serg5777

Andre, please tell me whether it is possible to fix something in the code so that similar images may not reflect the actual image? :)

serg5777

Here:

Αndré


serg5777