How I use cpmfetch V2.x inside img src ? How I use cpmfetch V2.x inside img src ?
 

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

How I use cpmfetch V2.x inside img src ?

Started by Zarzal, July 05, 2007, 09:52:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zarzal

Hello,
I use cpmfetch long time. Yesterday I change my webserver and by this way I have to upgrade something. Last version I work with was 1.9x and now I change to V2.0 release.
On my old days I use cpmfetch to display a randon image on my homepage (http://www.biker-reise.de/galerie.php) this way:
I write a littel php script (disp_scot.php) containing this:
<?php 
require_once "cfimageget.php";
$cpmfetch = new cfimageget();
$cpmfetch->setSourceString("cat=9");
$cpmfetch->getRandom();
?>

and use it at my page like this:
<a href="/gallerie/index.php?cat=9"><img src="/gallerie/cpmfetch/disp_scot.php" alt="random scot pics" align="left" /></a>
The align=left is used to position the thumb in front of my text and let flow the text around the thumb.

Now I notice that this no longer work with V2.0 or I cannot find out how. All is changed :)
I bring my page to work by replacing the img src code with the propper php code:
<?php
include_once "./gallerie/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./gallerie/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewRandomMediaFrom('cat=9',14$options);
$objCpm->cpm_close();
?>

With this I display 4 random pictures direct from cpmfetch. This is a workaround for my but should not the final solution. I like to display one random picture as in my old code to use the alignment. Is there a way to use cpmfetch V2.0 with the img src tag ? I cannot find any examples how to do this.

Regards

vuud

Quote from: Zarzal on July 05, 2007, 09:52:31 AM
Hello,
I use cpmfetch long time. Yesterday I change my webserver and by this way I have to upgrade something. Last version I work with was 1.9x and now I change to V2.0 release.
On my old days I use cpmfetch to display a randon image on my homepage (http://www.biker-reise.de/galerie.php) this way:
I write a littel php script (disp_scot.php) containing this:
<?php 
require_once "cfimageget.php";
$cpmfetch = new cfimageget();
$cpmfetch->setSourceString("cat=9");
$cpmfetch->getRandom();
?>

and use it at my page like this:
<a href="/gallerie/index.php?cat=9"><img src="/gallerie/cpmfetch/disp_scot.php" alt="random scot pics" align="left" /></a>
The align=left is used to position the thumb in front of my text and let flow the text around the thumb.

Now I notice that this no longer work with V2.0 or I cannot find out how. All is changed :)
I bring my page to work by replacing the img src code with the propper php code:
<?php
include_once "./gallerie/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./gallerie/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewRandomMediaFrom('cat=9',14$options);
$objCpm->cpm_close();
?>

With this I display 4 random pictures direct from cpmfetch. This is a workaround for my but should not the final solution. I like to display one random picture as in my old code to use the alignment. Is there a way to use cpmfetch V2.0 with the img src tag ? I cannot find any examples how to do this.

Regards

You switched to doing it the normal way.  You should go back to using cfimageget and you can still do it.   Or should be able to anyway.  If not, tell me why...

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

Zarzal

It seems that I have still some trouble on my new server to use it the old way. I get no image and I dont know why. I will investigate this weekend and will report what I find.

Zarzal

it seems that something is wrong with fopen on my new server. Looks like security restrictions. If I try to call my little php file direct in IE56 I get:
<br />
<b>Warning</b>:  fopen(albums/userpics/robert/tag03/thumb_01JUN19222.jpg): failed to open stream: No such file or directory in <b>/path to my space/schottland-2003.de/gallerie/cpmfetch/cfimageget.php</b> on line <b>263</b><br />

Thats why I dont get a picture on my homepage.

Zarzal

I found whats going on, but dont understand why :) If I change line 233 of cfimageget.php

//$filenametoshow = $_SERVER['DOCUMENT_ROOT'];
$filenametoshow .= $this->cpm->getImageToUse($row['pFilepath'],$row['pFilename'],$this->defaultsize);

to

//$filenametoshow = $_SERVER['DOCUMENT_ROOT'];
$filenametoshow = "http://www.mydomain.tld/coppermineroot/";
$filenametoshow .= $this->cpm->getImageToUse($row['pFilepath'],$row['pFilename'],$this->defaultsize);

it worked as it should. I try to fill out $urltocpm on top of the file but it seems that this is cleared somewhere while executing the script. The hardcode of the missing path statement fix my problem.

vuud

Quote from: Zarzal on July 06, 2007, 04:22:58 PM
it seems that something is wrong with fopen on my new server. Looks like security restrictions. If I try to call my little php file direct in IE56 I get:
<br />
<b>Warning</b>:  fopen(albums/userpics/robert/tag03/thumb_01JUN19222.jpg): failed to open stream: No such file or directory in <b>/path to my space/schottland-2003.de/gallerie/cpmfetch/cfimageget.php</b> on line <b>263</b><br />

Thats why I dont get a picture on my homepage.


Which version do you have?  Try the latest dev version... there was a bug in 2.0 with cfimageget that I think matches this problem (if I recall correctly).
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

Zarzal

I use V2.0 release. It seems you are right and there is a bug.
Now I run Dev 2.1.1 and it work as it should. Very nice, I learn a lot and use the cfimageget.php direct with parameter in my website instead using another external php file. I like it.
Thanks for support.

http://www.biker-reise.de/galerie.php