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 [2]   Go Down

Author Topic: Similar image  (Read 5507 times)

0 Members and 1 Guest are viewing this topic.

serg5777

  • Coppermine frequent poster
  • ***
  • Country: ru
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Широкоформатные обои для рабочего стола
Re: Similar image
« Reply #20 on: August 30, 2013, 08:11:35 am »

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 :)
Logged

serg5777

  • Coppermine frequent poster
  • ***
  • Country: ru
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Широкоформатные обои для рабочего стола
Re: Similar image
« Reply #21 on: August 30, 2013, 09:20:34 am »

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

serg5777

  • Coppermine frequent poster
  • ***
  • Country: ru
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Широкоформатные обои для рабочего стола
Re: Similar image
« Reply #22 on: August 30, 2013, 09:21:54 am »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Similar image
« Reply #23 on: August 30, 2013, 11:30:10 am »

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
Code: [Select]
    starttable();
    echo $picture;
    endtable();
and below, add
Code: [Select]
    // 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);
« Last Edit: September 02, 2013, 09:29:53 am by Αndré »
Logged

serg5777

  • Coppermine frequent poster
  • ***
  • Country: ru
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Широкоформатные обои для рабочего стола
Re: Similar image
« Reply #24 on: August 30, 2013, 12:18:59 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Similar image
« Reply #25 on: August 30, 2013, 12:30:03 pm »

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

serg5777

  • Coppermine frequent poster
  • ***
  • Country: ru
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Широкоформатные обои для рабочего стола
Re: Similar image
« Reply #26 on: August 30, 2013, 12:31:39 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Similar image
« Reply #27 on: August 30, 2013, 12:34:54 pm »

Ah, you want to add a table header :D

Replace
Code: [Select]
starttable();with something like
Code: [Select]
starttable(-1, 'Similar pictures');
Logged

serg5777

  • Coppermine frequent poster
  • ***
  • Country: ru
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Широкоформатные обои для рабочего стола
Re: Similar image
« Reply #28 on: August 30, 2013, 12:38:04 pm »

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!
Logged

serg5777

  • Coppermine frequent poster
  • ***
  • Country: ru
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Широкоформатные обои для рабочего стола
Re: Similar image
« Reply #29 on: September 02, 2013, 08:45:45 am »

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

serg5777

  • Coppermine frequent poster
  • ***
  • Country: ru
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Широкоформатные обои для рабочего стола
Re: Similar image
« Reply #30 on: September 02, 2013, 08:48:26 am »

Here:
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Similar image
« Reply #31 on: September 02, 2013, 09:29:08 am »

Please try the updated code.
Logged

serg5777

  • Coppermine frequent poster
  • ***
  • Country: ru
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Широкоформатные обои для рабочего стола
Re: Similar image
« Reply #32 on: September 02, 2013, 09:42:54 am »

Thank you, it works!
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.02 seconds with 19 queries.