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

Author Topic: working with cpmfetch and iframes  (Read 5153 times)

0 Members and 1 Guest are viewing this topic.

littlefeather

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
working with cpmfetch and iframes
« on: November 18, 2006, 12:05:55 pm »

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

Code: [Select]
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?
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: working with cpmfetch and iframes
« Reply #1 on: November 19, 2006, 05:29:09 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.

Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: working with cpmfetch and iframes
« Reply #2 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

Code: [Select]
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


Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: working with cpmfetch and iframes
« Reply #3 on: November 27, 2006, 12:27:39 am »

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

Code: [Select]
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

Code: [Select]
$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...






Logged
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
Pages: [1]   Go Up
 

Page created in 0.103 seconds with 20 queries.