forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: serg5777 on August 23, 2013, 08:01:32 am

Title: Similar image
Post by: serg5777 on August 23, 2013, 08:01:32 am
Andre a good day. Tell me is it possible to make a similar image on the page displayimage.php?
Maybe there is some plugin for that? :)
Title: Re: Similar image
Post by: Αndré on August 23, 2013, 11:07:09 am
If I remember correctly there's a mod or plugin available which automatically display similar pictures according to their histogram. I've had a quick look at the cpg1.5.x plugin contributions board, but haven't found it there (the thread is probably somewhere else). Is this what you're looking for?
Title: Re: Similar image
Post by: serg5777 on August 23, 2013, 12:52:09 pm
Yes, I want that this plugin, I'm willing to reward you financially for the help :)
Title: Re: Similar image
Post by: Αndré on August 23, 2013, 01:23:40 pm
I suggest to search our boards for that plugin / mod. I'm not absolutely sure that it was made for cpg1.5.x, maybe it was initially created for cpg1.4.x. However, if you find it, please post the link to the thread. I don't volunteer for creating such a plugin from, but are ready to help you to get it to work, if it doesn't work as expected.
Title: Re: Similar image
Post by: serg5777 on August 23, 2013, 01:29:25 pm
Thank you very much Andre, I will try to find this plugin!
Title: Re: Similar image
Post by: nickelas on August 25, 2013, 09:13:28 am
I posted a similar feature request (http://forum.coppermine-gallery.net/index.php/topic,61596.msg305597.html#msg305597) some time ago. Also found these threads:
http://forum.coppermine-gallery.net/index.php/topic,61596.msg305597.html#msg305597 (http://forum.coppermine-gallery.net/index.php/topic,61596.msg305597.html#msg305597)
http://forum.coppermine-gallery.net/index.php/topic,62619.msg311099.html#msg311099 (http://forum.coppermine-gallery.net/index.php/topic,62619.msg311099.html#msg311099)
Title: Re: Similar image
Post by: Αndré on August 26, 2013, 10:25:37 am
I think the second thread is the one I remembered. Unfortunately it seems that the plugin either hasn't been finished yet or isn't publicly available.
Title: Re: Similar image
Post by: serg5777 on August 26, 2013, 12:40:10 pm
Have carefully reviewed all of the plugins for 1.4, but unfortunately found nothing. Is it possible to simply display additional images under the picture of the album? Something like a filmstrip, but images are not in a row, scatter.
Title: Re: Similar image
Post by: Αndré on August 26, 2013, 01:32:17 pm
So you want to change the layout of the filmstrip?
Title: Re: Similar image
Post by: serg5777 on August 26, 2013, 01:45:53 pm
Well, as an option. It is necessary to do so in the filmstrip to display images from this album is not a row, and randomly.
Title: Re: Similar image
Post by: serg5777 on August 26, 2013, 01:52:38 pm
Slightly modifying the design then it will be a filmstrip like similar images :)
Title: Re: Similar image
Post by: Αndré on August 26, 2013, 02:04:13 pm
So you want to display random images from the same album. How exactly do you want to arrange them?
Title: Re: Similar image
Post by: serg5777 on August 26, 2013, 03:36:37 pm
So that they appear in the filmstrip.
Title: Re: Similar image
Post by: Αndré on August 26, 2013, 03:39:10 pm
like a filmstrip, but images are not in a row, scatter.
Please attach a screenshot / draft of how exactly it should look like.
Title: Re: Similar image
Post by: serg5777 on August 26, 2013, 03:48:39 pm
Well, that's the standard map filmstrip http://i59.fastpic.ru/big/2013/0826/55/13340693901fe048e7f1544d45687655.jpg

I need it to display images from an album randomly. So to speak, and will be similar to similar images.
Title: Re: Similar image
Post by: Αndré on August 26, 2013, 04:06:10 pm
I give up. You said you don't want to display them in a row. But if it's fine now to display them in a row, even better.
Title: Re: Similar image
Post by: serg5777 on August 26, 2013, 04:12:43 pm
Yes, Google translator can not translate properly for you to understand what I need :)
I need to make the images in the filmstrip were randomly, and did not go straight.
Title: Re: Similar image
Post by: serg5777 on August 26, 2013, 04:14:53 pm
To say it was just a block similar images in filmstrip.
Title: Re: Similar image
Post by: serg5777 on August 26, 2013, 04:16:02 pm
I will remove the arrows, there will be just four images from the album.
Title: Re: Similar image
Post by: Αndré on August 29, 2013, 05:32:08 pm
I had a short look at the filmstrip functions and I guess it's easier to built it from scratch. Do you want to wrap the images in the film strip design anyway (black background, tile images above and below)?
Title: Re: Similar image
Post by: serg5777 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 :)
Title: Re: Similar image
Post by: serg5777 on August 30, 2013, 09:20:34 am
Andre perhaps you I still do not understand, I will show you the screenshot below:
Title: Re: Similar image
Post by: serg5777 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.
Title: Re: Similar image
Post by: Αndré 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);
Title: Re: Similar image
Post by: serg5777 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?
Title: Re: Similar image
Post by: Αndré 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.
Title: Re: Similar image
Post by: serg5777 on August 30, 2013, 12:31:39 pm
To have similar picture was the same as that of a brown field and voting info :)
Title: Re: Similar image
Post by: Αndré 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');
Title: Re: Similar image
Post by: serg5777 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!
Title: Re: Similar image
Post by: serg5777 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? :)
Title: Re: Similar image
Post by: serg5777 on September 02, 2013, 08:48:26 am
Here:
Title: Re: Similar image
Post by: Αndré on September 02, 2013, 09:29:08 am
Please try the updated code (http://forum.coppermine-gallery.net/index.php/topic,76564.msg369643.html#msg369643).
Title: Re: Similar image
Post by: serg5777 on September 02, 2013, 09:42:54 am
Thank you, it works!