working with cpmfetch and iframes working with cpmfetch and iframes
 

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]

Main Menu

working with cpmfetch and iframes

Started by littlefeather, November 18, 2006, 12:05:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

littlefeather

I think I mentioned it in another post but I will repeat it just so it is easy to refer to...

I am using smf rc3, bridged with coppermine 1.6.4, Tinyportal as well as cpmfetch. ( thanks for the info btw, installed an configed from there no problems..)

I have the gallery coming into the centerblock via an article ( looks good so far)

On my frontpage I have a random image block with typical code of

print "<center>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(1,5,array("imagesize" => "Thumb","imageheight" => "78","imagewidth" => "104","windowtarget" => "_new"));
$objCpm->cpm_close();
print "</center>";


Now I know that the "windowtarget" is not the right call as it opens just the coppermine gallery in a new window. mOstly left it in there to make sure everything worked okay

I have read the manual, and the array options etc...

If I wanted to call up say .../portal/index?php.page=10

would I use one of these

cpm_OverridePathToCoppermine($newpath_)

cpm_OverrideUrlToCoppermine($newpath_)

or would it be something else?

vuud

Quote from: littlefeather on November 18, 2006, 12:05:55 PM
If I wanted to call up say .../portal/index?php.page=10

What does index?php/page=10 do?

Assuming you meant index.php?page=10...

If you want to change where cpmfetch is linking too, then you will need to get back the raw data and loop through it forming your own URLS.

An interesting idea - setting the url on the fly though.

Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

littlefeather

sorry vuud, haven't much time lately...

this "index.php?page=10" is actually what brings coppermine 'into' my site...it is just run in an iframe page.

I have a link to the gallery on my site, and it brings it into a 'center block' in tinyportal, but using the 'random image code with cpmfetch makes the gallery open on its own page, outside my site.

* I was using smfgallery, but it just doesn't have the features coppermine does which is why i switched but...
I use an ssi function for a random image block linked to the smfgallery mod and it works fine

the ssi code for the gallery is this

function ssi_grandom ($cat)
{
    global $scripturl,$modSettings,$db_prefix;
    $cat = (int) $cat;

    $request = db_query("SELECT thumbfilename, filename, ID_CAT, ID_PICTURE FROM {$db_prefix}gallery_pic WHERE ID_CAT = $cat GROUP BY thumbfilename ORDER BY RAND() LIMIT 1", __FILE__, __LINE__);
    $row = mysql_fetch_assoc($request);
    mysql_free_result($request);
    echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><img src="',$modSettings['gallery_url'], $row['thumbfilename'] ,'" /></a>';
}



every time I think i have this just about figured out...turns out not...

at the moment, i have both random image blocks working, ( different results, from each of course, only one viewable for public for now) let me know if you want to have a look and help me, and I will make both of them visible, it might help explain things a bit better... thanks



vuud

Quote from: littlefeather on November 23, 2006, 08:03:15 PM
sorry vuud, haven't much time lately...

this "index.php?page=10" is actually what brings coppermine 'into' my site...it is just run in an iframe page.

I have a link to the gallery on my site, and it brings it into a 'center block' in tinyportal, but using the 'random image code with cpmfetch makes the gallery open on its own page, outside my site.

* I was using smfgallery, but it just doesn't have the features coppermine does which is why i switched but...
I use an ssi function for a random image block linked to the smfgallery mod and it works fine

the ssi code for the gallery is this

function ssi_grandom ($cat)
{
    global $scripturl,$modSettings,$db_prefix;
    $cat = (int) $cat;

    $request = db_query("SELECT thumbfilename, filename, ID_CAT, ID_PICTURE FROM {$db_prefix}gallery_pic WHERE ID_CAT = $cat GROUP BY thumbfilename ORDER BY RAND() LIMIT 1", __FILE__, __LINE__);
    $row = mysql_fetch_assoc($request);
    mysql_free_result($request);
    echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><img src="',$modSettings['gallery_url'], $row['thumbfilename'] ,'" /></a>';
}



every time I think i have this just about figured out...turns out not...

at the moment, i have both random image blocks working, ( different results, from each of course, only one viewable for public for now) let me know if you want to have a look and help me, and I will make both of them visible, it might help explain things a bit better... thanks

Well, if you are good with that - you may as well keep on with it.

To do what you are looking for, you would basically be using cpmfetch to give you an array that you loop through and do essentially the same thing.  The first 5 lines would be replaced by cpmfetch config and calls.  The last line would be essentially the same.


// mind you thw $data[0] may be a 1, not a zero - I work in a bunch of programming languages and can never remember which are base 0 and base 1

$objCpm->cpm_setReturnType("resultset");
$data = $objCpm->cpm_viewLastAddedMedia(1, 1, "album=33,18,2");
$row = $data[0];
print_r($row);


The print_r will dump the array contents, so you can see the field names and stuff.  If you set subtitles, they should come back also in one of them...






Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco