Pulling images across sites with cpmFetch 2.0+ Pulling images across sites with cpmFetch 2.0+
 

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

Pulling images across sites with cpmFetch 2.0+

Started by Gephri, September 26, 2007, 08:59:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Gephri

I am unable to pull images from my CPG gallery site into a different site using the image tag with cpmFetch 2.0 - yet I was able to do so with cpmFetch 1.6 :

<img src="http://www.myothersite.com/gallery/cpmfetch/cfig_random.php" border="0" title="Click to see more photos">

the cfig_random.php had nothing special done to it:
<?php 
// MOD link to my gallery $urltocpm = "/gallery/"; -------------------------
/*****************************************************************************
 * CoppermineFetch :: cfig_random.php
 *
 * RELEASE VERSION: 1.6.4
 * 
 * This is an example of extending the cfimageget.php file to provide a more
 * secure and simpler access to your images.
 *
 * Usage:  Call this file from an img tag and it will return graphic data to you, customtize
 * it below
 *
 * 
 * The presedence is album over category, so if you add in both - you get whatever album is looking for
 */
require_once "cfimageget.php";

// Set this line to refer to the server side portion of the url
// For example, if your coppermine directory is at
//       http://www.fistfullofcode.com/photos
// You would use
//       "/photos/"
//
// If you installed CPG right to the root of your web site you would use:
//      "/"

$urltocpm "/gallery/";

$cpmfetch = new cfimageget($urltocpm);

/* Uncomment this if you want ACCESS TO  ANY PRIVATE  or non-private photos  */
//   $cpmfetch->setPrivacyFlagOn(false);

/* These can be used to limit the selection of photos 
the following are examples.
*/
//$cpmfetch->setSourceString("cat=7");                          // Category 7 only
//$cpmfetch->setSourceString("cat=7,6,8");                      // Categories 6, 7 and 8  only
//$cpmfetch->setSourceString("cat=7:album=1,2,3");     // Category 7 and albums 1, 2 and 3


/* This can be altered to change what is allowed for media types */
$cpmfetch->setAllowedTypes(array('.jpg','.gif','.png'));      //This is the default
  
/*
This section determines what kind of image will be returned
 Uncomment one of the following
*/

$cpmfetch->getRandom();
//$cpmfetch->getLastAdded();

?>


I have typical settings:
/cpg
/cpg/cpmfetch/
and permissions properly set.

Any idea how to pull pics (and even some of their data - views, etc.) from one site into another?

Thanks!

capecodgal

well this doesn't answer the question as to why it won't work for you in 2.0 but what I did on mine:

1) create a file to place the script  (i.e. Latest_images.php)
2) use an iframe script to call that page to load from the other site just make sure you turn off scroll bars and set the width and height properly


I like doing it this way as I can control the style to use in the php file


I'd be interested in seeing how others have done this differently-

Gephri

thanks capecodgal - and does your IFrame setup also show info like total views for each image pulled?

I've been able to pull images across two seperate domains with cpmFetch 1.6 - but couldn't get the image stats (like views)

Now that I can't even get the images pulled across domains with cpmFetch 2.0 - I'm l(sadly) ooking at all solutions.

Gephri

Vuud - or anyone else
Could my problem with trying to pull images across domains be due to the fact that v2.0 uses relative navigation in its coding?
Is there a workaround for this - to be able to pull from one domain to another?

capecodgal

Quote from: Gephri on September 28, 2007, 07:27:44 AM
thanks capecodgal - and does your IFrame setup also show info like total views for each image pulled?

I've been able to pull images across two seperate domains with cpmFetch 1.6 - but couldn't get the image stats (like views)

Now that I can't even get the images pulled across domains with cpmFetch 2.0 - I'm l(sadly) ooking at all solutions.





Ok well here is how I got it to work on 2 domains:

My domain where cpmfetch 2.0 is installed is http://hayden-collective.net/gallery
My 2nd domain where I have the iframe is http://ultimate-panettiere.com


So on ultimate-panettiere within my header file I have the iframe script pointing to the hayden-collective domain


<iframe src="http://hayden-collective.net/randomimages.php" frameborder="0" width="240"
height="170" marginwidth="0" marginheight="0" scrolling="no"> </iframe>



So you can see that script is pulling from the hayden-collective domain the file randomimages.php within that file I have the following:


<center>
<?php
  
require_once "./gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewRandomMediaFrom("cat=4,9,44,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,61,62,55,23,22,11,7,8,5,42,6,21,48,43,20,45,46,47,49,50,54,56,57,58,59,60,10,51,14,15,16:album=0",2,2,$options);
 
$objCpm->cpm_close();
?>

</center>


So as you can see all I am doing is loading the cpm script on the domain where it is installed and then using the iframe I can call that page to load from another domain. Now you wanted to include the view counts on each image, right? So that would make your randomimages.php (or whatever you decide to call it) look more like this:


<?php 
include_once "./photos/cpmfetch/cpmfetch.php";
$objCpm = new cpm('./photos/cpmfetch/cpmfetch_config.php');
$options = array( 'windowtarget' => '_blank');
$options = array("subtitle" => "<center> {{pHits}} Views</center>");
$objCpm->cpm_viewRandomMostViewedMediaFrom("cat=5:album=0",2,4,$options);
$objCpm->cpm_close(); 
?>





This is what will get you the view counts below the image:

$options = array("subtitle" => "<center> {{pHits}} Views</center>");





I hope all of that makes sense, I am by no means a coding guru - I am just good at finding ways to make things work even if I have to go round in circles to make it happen =)



Gephri

Vuud or Moderators -
Have I offended thee...?

I have really been hoping to get this working for months - but have not gotten direction from you.
I'm sure a few others would be interested - more than 300 have viewed my post.

Can you give us some help on how to properly pull images stats from one site to another using the incredibly versatile cpmFetch?

vuud

Quote from: Gephri on November 20, 2007, 08:36:27 AM
Vuud or Moderators -
Have I offended thee...?

I have really been hoping to get this working for months - but have not gotten direction from you.
I'm sure a few others would be interested - more than 300 have viewed my post.

Can you give us some help on how to properly pull images stats from one site to another using the incredibly versatile cpmFetch?

Not offended... I've just been sucked into so many other things I have not even looked here in some time!

Pulling images or image stats? 






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

Gephri

image stats actually - because the images do come across my sites