Problem: Can't Get cfimageget.php to Work Problem: Can't Get cfimageget.php to Work
 

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

Problem: Can't Get cfimageget.php to Work

Started by Wolfegar, May 20, 2007, 03:52:55 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

Wolfegar

No matter what I've tried, I just can't get this one bit to work.  I'd pull out my hair, but I like my hair, so I'll ask for a bit of help.

    * The Exact error message: 
Warning: fopen(albums/userpics/10001/thumb_VIEW_7.JPG) [function.fopen]: failed to open stream: No such file or directory in /home/myaccount/public_html/Gallery/cpmfetch/cfimageget.php on line 263

    * What version of coppermine you are using:  1.4.10
   
    * What version of CoppermineFetch you are using: CpmFetch Install Script version 2.0.0

    * A link to your website and gallery:  Website: http://www.wolfegar.com/
       Forum: http://www.wolfegar.com/Forum/index.php
       Gallery: http://www.wolfegar.com/Gallery/

    * A link to an example of the problem (if possible)
       A cheapy, down and dirty page only used for testing that I thought would work anyway:  http://www.wolfegar.com/index3.php
       cfimageget direct (so to speak): http://www.wolfegar.com/Gallery/cpmfetch/cfimageget.php

    * How computer savvy you are (newbie, intermediate, damn good):
       Uhm . . . I'd guess fair.  Don't know php, wrote a javascript once.  I can copy and paste.  I can follow instructions if the instructions are well written.  Explicit examples are always a big help for me.

    * What kind of web server you are running on (if known)
      Apache version 1.3.37 (Unix)
      MySQL version 4.1.21-standard
      PHP version 4.4.6
      Kernel version 2.6.9-42.0.10.ELsmp
      Machine Type i686

    * Include the code you are using.  Okay, but as it's a quicky down and dirty thing only for testing purposes it's going to be messy.


<head>
</head>

<body>

<?php
  
include_once "./Gallery/cpmfetch/cpmfetch.php";
  
$objCpm = new cpm("./Gallery/cpmfetch/cpmfetch_config.php");
  
$options = array("subtitle" => "File name : {{pFilename}}");
  
$objCpm->cpm_viewLastAddedMedia(14$options);
  
$objCpm->cpm_viewRandomMediaFrom("cat=1",14$options);
   
?>

<br><br>

<?php
  $options 
= array("subtitle" => "File name : {{pFilename}}");
  
$objCpm->cpm_viewRandomMediaFrom("cat=1",11$options);

?>


<br><br>
The filename one.
<?php
  $options 
= array("subtitle" => "{{pFilename}}");
  
$objCpm->cpm_viewRandomMediaFrom("cat=1",11$options);
?>


<br><br>
The title one.
<?php
  $options 
= array("subtitle" => "{{pTitle}}");
  
$objCpm->cpm_viewRandomMediaFrom("cat=1",11$options);
?>


<br><br>
The caption one
<?php
  $options 
= array("subtitle" => "{{pCaption}}");
  
$objCpm->cpm_viewRandomMediaFrom("cat=1",11$options);
?>


<br><br>

<?php
  $objCpm
->cpm_viewRandomMediaFrom("cat=1",11);
?>


<br><br>

<?php
  $options 
= array("subtitle" => "{{pTitle}}");
  
$objCpm->cpm_viewRandomMediaFrom("cat=1",11$options); 
?>


<br><br>

<?php
  $objCpm
->cpm_close(); 
?>


<br><br>image source cfimageget thingy<br>
<img src="./Gallery/cpmfetch/cfimageget.php" />
<br><br>
<br><br>
JavaScript thingy to use with cpmfetch
<br><br>

<script type="text/javascript">
var cpr_albumid=''; //album id if not used set ''
var cpr_catid='1';   //Category id if not used set ''
var resulttype = 'randomfromcategory'; //Result type from below array.
var rows=1; //Number of rows
var col=1; //Number of columns
var jscriptFetchFile='http://www.wolfegar.com/Gallery/cpmfetch/plugins/cpmfetchjs/jsfetch2.php';
</script>

<script type="text/javascript">
document.write("<script type=\"text/javascript\" src=\""+jscriptFetchFile+"?albumid="+cpr_albumid+"&catid="+cpr_catid+"&resulttype="+resulttype+"&rows="+rows+"&col="+col+"\"><\/script>");
</script>

<br><br>
<br><br>
JavaScript thingy to use with cpmfetch second call instance.
<br><br>
<script type="text/javascript">
rows=2; col=2;
document.write("<script type=\"text/javascript\" src=\""+jscriptFetchFile+"?albumid="+cpr_albumid+"&catid="+cpr_catid+"&resulttype="+resulttype+"&rows="+rows+"&col="+col+"\"><\/script>");
</script>


<br><br>
<br><br>
JavaScript thingy to use with cpmfetch third call instance.
<br><br>
<script type="text/javascript">
rows=1; col=1; resulttype='lastmedia';
document.write("<script type=\"text/javascript\" src=\""+jscriptFetchFile+"?albumid="+cpr_albumid+"&catid="+cpr_catid+"&resulttype="+resulttype+"&rows="+rows+"&col="+col+"\"><\/script>");
</script>

<br><br>
<br><br>
JavaScript thingy to use with cpmfetch fourth call instance.
<br><br>
<script type="text/javascript">
rows=1; col=1; resulttype='random';
document.write("<script type=\"text/javascript\" src=\""+jscriptFetchFile+"?albumid="+cpr_albumid+"&catid="+cpr_catid+"&resulttype="+resulttype+"&rows="+rows+"&col="+col+"\"><\/script>");
</script>


</body>

</html>


And finally, my forum (IPB 1.3.something) is bridged with Coppermine and MKPortal.  I couldn't get anything of the cpmFetch stuff to work in the portal but I'm not worried about that right now.  Your new installer did pick up the bridge between the forum and Coppermine.

In this bit from the cfimageget.php file:

// CHANGE THIS TO TRUE IF PEOPLE ARE ALLOWED QUERIES THROUGH HERE
$ALLOW_DIRECT_ACCESS = true;

if ($ALLOW_DIRECT_ACCESS && substr($_SERVER['SCRIPT_FILENAME'],-14) == "cfimageget.php") {

// This one you need to adjust unless your galler is at http://www.youname.com/photos
// If you installed right to the root of your web site, just use a /
// TODO This should be path to config file
// $urltocpm = "/Gallery";
$pathToConfigFile = "./Gallery/include/config.inc.php";


I have tried:

$pathToConfigFile = "./Gallery/include/config.inc.php";
$pathToConfigFile = "../Gallery/include/config.inc.php";
$pathToConfigFile = "/home/myaccountname/public_html/Gallery/include/config.inc.php";
$pathToConfigFile = "/";
$pathToConfigFile = "";

All to no avail.  I'm sure this must be something so simple that I'm just not seeing it.  Over the past few weeks I've search the forums here a dozen times and read and re-read the threads in an effort to discover the answer on my own.  I've read the documentation that came in the cpmFetch download.  (BTW, the images are missing.)  I've visited your site, (the link is in your siggy so I won't repeat it here.)  I also tried a google search, but I don't have a Minola Dimage 5, (or 7), camera where I'm trying to get the camera to communicate with a linux system although most of the links come back here to threads I'd already read.  (That was a trick, wasn't it?)

A quick look at my forum's index page will show two images that are pulled using remdex's JavaScript add-on your modification to pull a random image on the left and the last image on the right.  cpmFetch and that JavaScript does seem to be working.  It's just the cfimageget thingy seems to be stubborn for some reason.

Question:  In cpmfetch_config.php, is this line: 'cfENABLE_cfimageget' => 'false' supposed to be set to false?

Wolfegar

I have been waiting patiently for the past six days for someone to explain to me what I need to do to get cfimageget.php to work.  I think I've provided enough information so that someone who actually got this to work or for vuud, the creator of this add-on, to be able to help me.  If there is some detail missing that is required for anyone to be able to help me, then please, let me know.

I have tried to figure this out.  I've searched and read the posts here in this sub-forum.  I've read the documentation.  If some folk have gotten this to work then there is something that is obvious to them but not obvious to me.  I do not tend to ask for help unless I need it.

Someone, please answer me this at the very least.  In the cfimageget.php file, these lines:

// $urltocpm = "/Gallery";
$pathToConfigFile = "./Gallery/include/config.inc.php";


What should they be if my gallery is at:  http://www.wolfegar.com/Gallery/ and cpmFetch is at http://www.wolfegar.com/Gallery/cpmfetch/ ?
Which ConfigFile is being asked for here?  It isn't clear if it is supposed to be the one for the gallery or the one for cpmFetch.  Should it include the file name at the end or not?  Is $urltocpm = "/Gallery"; supposed to be commented out?

vuud

Quote from: Wolfegar on May 26, 2007, 03:06:52 PM
I have been waiting patiently for the past six days for someone to explain to me what I need to do to get cfimageget.php to work.  I think I've provided enough information so that someone who actually got this to work or for vuud, the creator of this add-on, to be able to help me.  If there is some detail missing that is required for anyone to be able to help me, then please, let me know.

Yeah, thats a good amount of information.  I just have not had time to spend on the boards lately.  Hopefully I can spend more and more, but it is gardening season, and work has been... well, work.

Anyway...

Yes - the enable should be true.


Quote
I have tried to figure this out.  I've searched and read the posts here in this sub-forum.  I've read the documentation.  If some folk have gotten this to work then there is something that is obvious to them but not obvious to me.  I do not tend to ask for help unless I need it.

Someone, please answer me this at the very least.  In the cfimageget.php file, these lines:

// $urltocpm = "/Gallery";
$pathToConfigFile = "./Gallery/include/config.inc.php";


What should they be if my gallery is at:  http://www.wolfegar.com/Gallery/ and cpmFetch is at http://www.wolfegar.com/Gallery/cpmfetch/ ?
Which ConfigFile is being asked for here?  It isn't clear if it is supposed to be the one for the gallery or the one for cpmFetch.  Should it include the file name at the end or not?  Is $urltocpm = "/Gallery"; supposed to be commented out?

For what you are saying this...


// $urltocpm = "/Gallery";
$pathToConfigFile = "./Gallery/include/config.inc.php";


may work as


// $urltocpm = "/Gallery";
$pathToConfigFile = "";


But now looking at the code, something is strange.  if you call your cfimageget directly and do "view source" you will see an error that PHP has delightlfully stuck in there for you.  I have to go through this code later and see what it is doing.  Some other things in there do not look competely correct either.  Not on your part, on mine.

Hopefully I can look at it tonight










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

Wolfegar

Greetings, vuud!  Glad to see you made it in.  The Wifey does the gardening around our place and she's been doing a lot of work out there.  I have a day job that takes almost all of my time.  Which is why I haven't had time to actually learn php.  I am trying to pick up a little here and there as I go though.

Anyway, I was looking through the cfimageget.php file and came across this.  Now, correct me if I'm wrong, but doesn't the function cfimageget shown here clear the $pathToConfigFile or am I reading it wrong?

class cfimageget {

var $cpm;
var $urltocpm;
var $filepathtocpm;

var $sourceString = "";
var $albumSelection = "";
var $categorySelection = "";

var $debugMode = false;

     var $thumbnailprefix='thumb_';
var $intermedprefix='normal_';
var $fullsizeprefix='';
var $defaultsize = "thumb_";

var $version = "2.0.0";

var $allowedtypes = array('.jpg','.gif','.png');

function cfimageget ($pathToConfigFile = "") {
$this->cpm = new cpm_dao($config_file);
$this->cpm->cpm_debugMode("false");

} // end cfimageget



In the
// $urltocpm = "/Gallery";
   $pathToConfigFile = "";

I've tried:


  • ""
  • "/"
  • ./
  • ../
  • ./../
  • ../../

as well as the variations in my first post.  I also tried it with and without the config's file name.  I appreciate any help you can give me on this.  Thank you.


vuud

Quote from: Wolfegar on May 30, 2007, 12:43:36 AM
...

Anyway, I was looking through the cfimageget.php file and came across this.  Now, correct me if I'm wrong, but doesn't the function cfimageget shown here clear the $pathToConfigFile or am I reading it wrong?



...snip...

function cfimageget ($pathToConfigFile = "") {
$this->cpm = new cpm_dao($config_file);
$this->cpm->cpm_debugMode("false");

} // end cfimageget




If you mean the function cfimageget ($pathToConfigFile = "") line clearing it, no.  What that does is sets a default for the parameter which makes it optional.  So if you call cfimageget with nothing, it treats it as an empty string.

If you go directly to cfimageget.php and then view source on the resulting html you see an error like:

fopen(albums/userpics/10001/thumb_WAXDRIP1.JPG ...

So its finding the data on the picture, but is not calling the correct path to get to it.









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

Wolfegar

Quote from: vuud on May 31, 2007, 04:48:51 PM

If you mean the function cfimageget ($pathToConfigFile = "") line clearing it, no.  What that does is sets a default for the parameter which makes it optional.  So if you call cfimageget with nothing, it treats it as an empty string.

If you go directly to cfimageget.php and then view source on the resulting html you see an error like:

fopen(albums/userpics/10001/thumb_WAXDRIP1.JPG ...

So its finding the data on the picture, but is not calling the correct path to get to it.


I find this vexing.  I'm hoping you'll be able to find out what's wrong because I'm stumped.  Of course, I don't know about php coding and just barely know some javascript.  Is this an error in the cfimageget code or did I do something wrong?

vuud

Quote from: Wolfegar on May 31, 2007, 11:51:52 PM
I find this vexing.  I'm hoping you'll be able to find out what's wrong because I'm stumped.  Of course, I don't know about php coding and just barely know some javascript.  Is this an error in the cfimageget code or did I do something wrong?

I suspect cfimageget - the problem is that it is getting your album directory relative to the CPG install, not from the top of the file system - so therefore it cannot find the file.

You've probably done everything right.

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

chican0

At least you can get that far... I have been round and round with it and simply get a blank page.

chican0

Well, shortly after making my post, I discovered that I needed to set the script to TRUE for direct access.

Then I found I was in the same boat as Wolfegar and got the same errors.

I found a work around to get this to work for now.

What I did was edit cfimageget.php. I uncommented and changed the following line: //$filenametoshow = $_SERVER['DOCUMENT_ROOT'];and changed to$filenametoshow = "../";
After doing that change, I was able to see an image at http://www.clubflys.com/v2/v2_gallery/cpmfetch/cfimageget.php.

I soon found that I was able to use the cmd, album, and cat functions but when I tried to use the size function, I could not get the INT size to work. Instead, the large image was returned. Being that I need this for the normal_ prefixed images, I changed the default size to be normal_.

It is working as I need now. Thanks!

Wolfegar

That's interesting, chican0.

function _dumpPhoto($resultset ) {
if (count($resultset)==0) {
$ERROR = true;
$ERROR_NO = 5;
$filenametoshow = './problem.gif';
} else {
$row = array_shift($resultset);
//$filenametoshow = $_SERVER['DOCUMENT_ROOT'];
$filenametoshow = "../";
$filenametoshow .= $this->cpm->getImageToUse($row['pFilepath'],$row['pFilename'],$this->defaultsize);
}


Rather than uncomment the original line, I decided to copy your line and insert it just below the one that is commented.  It worked, thank you.  As to passing arguments to cfimageget.php goes, I haven't actually tried that yet.  I wanted to get the file by itself working first.  I seem to be running short on time this morning so it'll be off to work soon so I can't play with that now.

Oh, I had to try it with the commented line uncommented and before adding your bit.  I got a slightly different error message.

QuoteWarning: fopen(/home/MyAccount/public_htmlalbums/userpics/10087/thumb_rose_autumn_edited2.JPG) [function.fopen]: failed to open stream: No such file or directory in /home/MyAccount/public_html/Gallery/cpmfetch/cfimageget.php on line 265
Note the lack of a "/Gallery/" between the public_html and the albums part at the beginning.

Say vuud, in this line: 
$filenametoshow .= $this->cpm->getImageToUse($row['pFilepath'],$row['pFilename'],$this->defaultsize);
is that dot just before the "=" after $filenametoshow supposed to be there? 

Wolfegar

Quote from: chican0 on June 08, 2007, 02:58:21 AM
*Snippys*

What I did was edit cfimageget.php. I uncommented and changed the following line: //$filenametoshow = $_SERVER['DOCUMENT_ROOT'];and changed to$filenametoshow = "../";
After doing that change, I was able to see an image at http://www.clubflys.com/v2/v2_gallery/cpmfetch/cfimageget.php.

I soon found that I was able to use the cmd, album, and cat functions but when I tried to use the size function, I could not get the INT size to work. Instead, the large image was returned. Being that I need this for the normal_ prefixed images, I changed the default size to be normal_.

It is working as I need now. Thanks!
When you tried the int size, did you use it as:  http://www.clubflys.com/v2/v2_gallery/cpmfetch/cfimageget.php?cat=1&size=int

It seems to work with mine.  http://www.wolfegar.com/Gallery/cpmfetch/cfimageget.php?cat=1&size=int

chican0

I did try that, but it did not work. I even tried different combinations such as

cfimageget.php?album=361&size=int
cfimageget.php?cat=3&size=int
cfimageget.php?size=int&cmd=last
cfimageget.php?size=int&album=332
cfimageget.php?size=int

Everything worked such as album selection, category selection, last imge posted selection. What didn't work for me was getting the nomal_ sized image. I can tell the difference of my normal size images from the intermediate because my normal size images are 600x400 ratio and the intermediate sized images all have the larger side at 400px.

I am going to install another copy of cpmfetch in another location for additional testing. I do not want to mess around with what I have working right now.

I will do some more testing and report back.

vuud

Quote from: chican0 on June 09, 2007, 07:58:07 AM
I did try that, but it did not work. I even tried different combinations such as

cfimageget.php?album=361&size=int
cfimageget.php?cat=3&size=int
cfimageget.php?size=int&cmd=last
cfimageget.php?size=int&album=332
cfimageget.php?size=int

Everything worked such as album selection, category selection, last imge posted selection. What didn't work for me was getting the nomal_ sized image. I can tell the difference of my normal size images from the intermediate because my normal size images are 600x400 ratio and the intermediate sized images all have the larger side at 400px.

I am going to install another copy of cpmfetch in another location for additional testing. I do not want to mess around with what I have working right now.

I will do some more testing and report back.

Needless to say there is some screwy stuff going on in cfimageget.

I just recoded a bunch of stuff.  It will be posted in version 2.1.1

Basically the re-working for 2.0 broke some things in there. 


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

chican0

Oh boy. Well, at least there will be a newer version for those who want to use it.

As for me, I am happy with how it is working for me since it is "now" doing exactly what I need it to do.

Thanks again!!!! You're the best!

vuud

Quote from: chican0 on June 20, 2007, 10:57:37 AM
Oh boy. Well, at least there will be a newer version for those who want to use it.

As for me, I am happy with how it is working for me since it is "now" doing exactly what I need it to do.

Thanks again!!!! You're the best!

Okay,

BTW, I noticed in your examples you are using cat=...  that does not do anything.  For some reason I used category= there instead.  The next version will allow cat= 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

Wolfegar

Ah, thank you, vuud!  Should I download 2.1.1 now or wait until it's confirmed stable?

(Real life has gotten very busy of late, or I'd have seen the above posts sooner.  ::) )

vuud

Quote from: Wolfegar on July 21, 2007, 01:56:43 AM
Ah, thank you, vuud!  Should I download 2.1.1 now or wait until it's confirmed stable?

(Real life has gotten very busy of late, or I'd have seen the above posts sooner.  ::) )

Wait for the next one 2.1.2... there are a few bugs in 2.1.1 that are fixed in it.

Stable has a funny meaning when it comes to cpmfetch.

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