CpmFetch 1.4 On... Displaying data and images from CPG on your website - Page 51 CpmFetch 1.4 On... Displaying data and images from CPG on your website - Page 51
 

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

CpmFetch 1.4 On... Displaying data and images from CPG on your website

Started by vuud, July 08, 2005, 06:43:10 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

haribo85

Thanks for the link, but I am still lost.

Where do I make this change?

Thanks for your time!

vuud

Quote from: haribo85 on August 10, 2006, 04:12:17 PM
Thanks for the link, but I am still lost.

Where do I make this change?

Thanks for your time!

In the Joomla or whatever file where you see that code... I don't use Joomla so I have no idea.

Read this if you still don't get what to do with the previous link and the $options entry there read this:
http://www.fistfullofcode.com/projects/copperminefetch/manual/ch06.html

That has everything you need


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

haribo85

So where as before I would have

echo "<center>";
include $cpmFetch."/cpmfetch.php";
$objCpm = new cpm($gallery);
$objCpm->cpm_viewRandomMedia(1,1, $options);
$objCpm->cpm_close();
echo "</center>";


Now I would have this? Please correct me if I'm wrong, Im a bit confused by this.

echo "<center>";
include $cpmFetch."/cpmfetch.php";
$objCpm = new cpm($gallery);
$objCpm->cpm_viewRandomMedia(1,1, imagelink => "none", $options);
$objCpm->cpm_close();
echo "</center>";


Thanks for your time.

vuud

Quote from: haribo85 on August 10, 2006, 04:26:00 PM
So where as before I would have

echo "<center>";
include $cpmFetch."/cpmfetch.php";
$objCpm = new cpm($gallery);
$objCpm->cpm_viewRandomMedia(1,1, $options);
$objCpm->cpm_close();
echo "</center>";


Now I would have this? Please correct me if I'm wrong, Im a bit confused by this.

echo "<center>";
include $cpmFetch."/cpmfetch.php";
$objCpm = new cpm($gallery);
$objCpm->cpm_viewRandomMedia(1,1, imagelink => "none", $options);
$objCpm->cpm_close();
echo "</center>";


Thanks for your time.

Well, at least this shows some effort.

Anyway, you are close.  the $option variable is an array in my examples, so if you are using it already somewhere then you should add the imagelink to that.  If not you can create the array right there like so:


$objCpm->cpm_viewRandomMedia(1,1, array(imagelink => "none"));


Which is the same as


$options = array (imagelink => "none");
$objCpm->cpm_viewRandomMedia(1,1, $options);


You see?

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

haribo85

Thanks, working perfectly, i understand how its working now, just!

But if i want to add another option like image size and width, do i add another option array? I have read the page on image sizing and have seen if i just specify the imagewidth it will keep the ratio, so is it something like this?


echo "<center>";
include $cpmFetch."/cpmfetch.php";
$objCpm = new cpm($gallery);
$options = array (imagelink => "none");
$options2 = array ( imagewidth=> "20px");
$objCpm->cpm_viewRandomMedia(1,1, $options, $options2);
$objCpm->cpm_close();
echo "</center>";


vuud

Quote from: haribo85 on August 10, 2006, 05:04:07 PM
Thanks, working perfectly, i understand how its working now, just!

But if i want to add another option like image size and width, do i add another option array? I have read the page on image sizing and have seen if i just specify the imagewidth it will keep the ratio, so is it something like this?


echo "<center>";
include $cpmFetch."/cpmfetch.php";
$objCpm = new cpm($gallery);
$options = array (imagelink => "none");
$options2 = array ( imagewidth=> "20px");
$objCpm->cpm_viewRandomMedia(1,1, $options, $options2);
$objCpm->cpm_close();
echo "</center>";



The www.php.net documentation would cover arrays in a much wider scope, but no you would not stack arrays.  The second one above would just be ignored.  You want to add it to the first one:

$options = array ('imagelink' => 'none', 'imagewidth'=> '20px');

I also personally always single quote them all.  Double quotes are interpreted for variables.  I also do the first one simply because it is a good habit to be in.  Anyway YMMV on that one depending on who you ask.








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

marian

Quote from: vuud on August 09, 2006, 09:33:31 PM
You could also be insane.
Are you thinking of rss_lastadded.php ?

This is no specific way to do that, but if you trace through the cfrssget.php file adding in a source should not be too hard.  I would make a copy of the rss_lastadded.php to a new name (like rss_myfeed.php or somethign more descriptive.)

Then modify that line that looks like:

$cfrss->addLastAddedMedia($totalToShow);

To include a source entry:

$cfrss->addLastAddedMedia($totalToShow,"cat=5");

That will do category 5... I think, I did not test it... just peaked at the code quickly.

You've got it, I'm completely nuts. Don't know how anyone can look at code for a couple of hours and be anything else!  ;D
Yesterday, I created an RSS feed from the whole gallery, using Tarique's script, and to my utter amazement it worked first time. Snag was that, straight away, we had folks saying "Can we just have latest Yacht Racing pix?", so here I came!!!
Have tried your trick and when I put www.bymnews.com/cpmfetch/rss_yachtrace.php in Feed Reader I got No RSS URLs found. I then checked with last added and got the same result, so I've obviously screwed something.
?????????

vuud

Quote from: marian on August 10, 2006, 06:33:42 PM
You've got it, I'm completely nuts. Don't know how anyone can look at code for a couple of hours and be anything else!  ;D
Yesterday, I created an RSS feed from the whole gallery, using Tarique's script, and to my utter amazement it worked first time. Snag was that, straight away, we had folks saying "Can we just have latest Yacht Racing pix?", so here I came!!!
Have tried your trick and when I put www.bymnews.com/cpmfetch/rss_yachtrace.php in Feed Reader I got No RSS URLs found. I then checked with last added and got the same result, so I've obviously screwed something.
?????????

I don't know what you did wrong.  If the Tarique script works for you then stick with that - does not bother me which one you use.

Did you change this line in the top of the file?
$ENABLED =false;

to

$ENABLED = true;

Does that help?

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

scifirocket21

I uploaded the files, and got as far as being able to make the test work (see it here: http://www.mydpnet.com/cpmfetch/cftest.php).  Now I have no idea what to do next.  I read documentation for this, but I just got more and more confused the more i read it. 

What I'm trying to accomplish is getting this mod to show the newest photo uploaded to the gallery on my HTML coded home page found at www.mydpnet.com. 

Any help would be greatly appricated. 

vuud

Quote from: scifirocket21 on August 12, 2006, 04:40:26 AM
I uploaded the files, and got as far as being able to make the test work (see it here: http://www.mydpnet.com/cpmfetch/cftest.php).  Now I have no idea what to do next.  I read documentation for this, but I just got more and more confused the more i read it. 

What I'm trying to accomplish is getting this mod to show the newest photo uploaded to the gallery on my HTML coded home page found at www.mydpnet.com. 

Any help would be greatly appricated. 

http://cpmfetch.fistfullofcode.com/projects/copperminefetch/quickstart.php
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

scifirocket21

Ok, I feel silly.  I did read that thing before I started, but it was a path error.  Everything is working the way I want it to, except one thing.  How do I get it to appear on a HTML page that is not in the same directory as CPMFETCH.

vuud

Quote from: scifirocket21 on August 12, 2006, 08:09:31 AM
Ok, I feel silly.  I did read that thing before I started, but it was a path error.  Everything is working the way I want it to, except one thing.  How do I get it to appear on a HTML page that is not in the same directory as CPMFETCH.

For an HTML (non-php) page you cannot do that as it is... I've got a few work arounds in here that you can use depending on what you want to do.

1.  You can use cfimageget - but that limits you to one image

2.  You can use Server Side Includes to include a php file that executes the cpmfetch commands

3.  Make your .HTML pages .PHP pages

Probably #2 you want
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

GuTe

Hi all,

I'm having problems with displaying the images on my website. When i run cftest.php it fails to find the config.inc.php file (http://www.nordisktfiske.se/cpmfetch/cftest.php)

I have cpmfetch in a sperate folder and the copperimne gallery is in /photos.

In order to display the images on my site i use this code:

<?php 
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/photos");
$objCpm->cpm_viewRandomMedia(1,1,array("windowtarget" => "_blank","imagestyle" => "imgborder""imagewidth" => "140"));
$objCpm->cpm_close();
?>


All of this work on an other website I had but not on this one. Can someone see what the problem is?
I've been looking thru the forum, but with no luck.

vuud

Quote from: GuTe on August 13, 2006, 08:51:29 AM
Hi all,

I'm having problems with displaying the images on my website. When i run cftest.php it fails to find the config.inc.php file (http://www.nordisktfiske.se/cpmfetch/cftest.php)

I have cpmfetch in a sperate folder and the copperimne gallery is in /photos.

In order to display the images on my site i use this code:

<?php 
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/photos");
$objCpm->cpm_viewRandomMedia(1,1,array("windowtarget" => "_blank","imagestyle" => "imgborder""imagewidth" => "140"));
$objCpm->cpm_close();
?>


All of this work on an other website I had but not on this one. Can someone see what the problem is?
I've been looking thru the forum, but with no luck.


Your server is returning a document_root that is not the same as your own document root.

Try this (and I have no idea if it will work, but I will get a good laugh if it does):

$objCpm = new cpm("../../home/nordisktfiske.se/www/photos");

Like I said, no idea what that will do (won't break anything of course)

Lemme know what happens



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

GuTe

Really strange...

I tried with your solution, but it turned out like this:
Path to Coppermine incorrect. (/var/www../../home/nordisktfiske.se/www/photos//include/config.inc.php)


vuud

Quote from: GuTe on August 13, 2006, 06:14:58 PM
Really strange...

I tried with your solution, but it turned out like this:
Path to Coppermine incorrect. (/var/www../../home/nordisktfiske.se/www/photos//include/config.inc.php)




$objCpm = new cpm("/../../home/nordisktfiske.se/www/photos");


Sorry, I was off.  This may work... (added a leading slash)


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

GuTe

Thanks for the help, but I still get an error:

ERROR: Path to Coppermine incorrect. (/var/www/../../home/nordisktfiske.se/www/photos//include/config.inc.php)

It looks like I wont be able to use this on the site.

vuud

Quote from: GuTe on August 13, 2006, 07:28:29 PM
Thanks for the help, but I still get an error:

ERROR: Path to Coppermine incorrect. (/var/www/../../home/nordisktfiske.se/www/photos//include/config.inc.php)

It looks like I wont be able to use this on the site.

yeah, just not as easily...

Open cpmfetch.php find this line

Somewhere around 75

if (array_key_exists("DOCUMENT_ROOT",$_SERVER )) {
$this->filepathtocpm = $_SERVER['DOCUMENT_ROOT'] . $urltocpm_;
} elseif (ini_get("doc_root") != "") {


Change the middle line to look like this:

   $this->filepathtocpm = "/home/nordisktfiske.se/www/photos/";

If that does not work, you need to figure out what your path is to you web directory... that should be it.

Hope this helps.




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

GuTe

Woohoo!!!

Now I got something different:

Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/nordisktfiske.se/www/cpmfetch/cpmfetch_dao.php on line 710

but it looks like it will work :)

GuTe

I found it while searching the forum and I change the big sql statement in cpmfetch_dao.php.

Now I get Error in getImageTouse: Extension (strtolower): .jpg

The server has GD 2 installed.