Advanced search  

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

Pages: [1] 2   Go Down

Author Topic: CpmFetch - Using CpmFetch on HTML pages via SSI  (Read 42365 times)

0 Members and 1 Guest are viewing this topic.

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
CpmFetch - Using CpmFetch on HTML pages via SSI
« on: June 03, 2005, 06:24:43 pm »

http://cpmfetch.fistfullofcode.com - latest info, news, development versions, tips, etc
Also a sign up to my site for email notifications of new updates to cpmfetch.

This thread is dedicated to the issue surrounding using CpmFetch as a SSI (Server side include) on Apache.  I have no idea what they call it under IIS (Internet Infernal Services) on Windoze.  But the principle should be the same (maybe).

I plan on releasing a fully function cpmssi module in the future, but for now you easily accomplish the same effect other ways.

This is incredibly simple so I am sorry I did not post these solutions eariler

I will add in the information in the next posting...


« Last Edit: June 03, 2005, 06:46:22 pm by vuud »
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

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
How to use CPMFETCH as a SSI
« Reply #1 on: June 03, 2005, 06:42:53 pm »

I just tried this and it works fine...

Here are some assumptions I use in this document, you can change them of course, but this will help you figure out which parts you can change.  You do not have to use these paths, please change them to whatever you want, just be consistent

Coppermine is installed into /cpg
CpmFetch has been installed into /cpmfetch
Your HTML page is in the root of the web site /
You create the new file in /cpmfetch

Here are the steps I went through:

1.  Get cpmfetch installed
A normal install, follow the directions.

2.  Make sure the cpmtest.php file is working
This is part of the directions, but thought it would be worth mentioning anyway

3.  Create a new file named randomimages.php file
The filename can be whatever you want, but must be .php

4.  Edit "randomimages.php" and add in the following code:

Code: [Select]

<?php 
include "./coppermine.php";
$objCpm = new cpm('/cpg');
$objCpm->cpm_viewLastAddedMedia(4,2); 
$objCpm->cpm_close(); 
?>



The cpm_viewLastAddedMedia can be altered to any of the function calls.  This is just my example.

Note:  The first and second lines will need to be edited to your specific installation.  The /cpg would be the same value you used to get cftest.php working.  The include is the path to where you installed the cpmfetch program.

5. Edit your HTML file
Include the following line (Apache users) where you want the HTML table to be inserted.

Code: [Select]

<!--#include virtual="/cpmfetch/ssitest.php" -->


6.  Tell the server its okay to execute SSI commands

Now you need to tell the server it is okay to execute commands inside the HTML.  This can be done a few ways.

* You can use .shtml on some servers instead of .html
* You can add a file named ".htaccess" with "XBitHack On" on it and change the permissions to execute (chmod 755)

Apache documentation for SSI can be found here:
http://httpd.apache.org/docs/howto/ssi.html

7.  Check it with your web browser...

It should work. 

If not, view the source... if you see <!--#include virtual="/cpmfetch/ssitest.php" --> in there still, then it means that your web server is not noticing it can execute.  Review step 6 and the apache documentation. 

If the #include is missing, then it means that your server is okay, your just not getting any pictures back.  Try executing the PHP file directly.

Please post comments or corrections... and if any IIS user wants to step up and note how to do it on IIS, that would be great!

Hope this helps

Vuud



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

mustang_lex

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 34
    • Stangette.com
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #2 on: June 07, 2005, 06:58:19 pm »

I am sooo lost.  What do you put in the HTML document to pull up the randomimages.php we created earlier?

UPDATE: I got it to  work. I missed changing /cpg to mine /showcase . and it works now.

Where can I get different varibles (setup of thumbnails ect.)

also I found it slow to do. Is there a faster way.
my .htaccess has

Quote
Options +Includes
XBitHack on
chmod +x index2.html

Is there something different I should do
« Last Edit: June 07, 2005, 07:06:26 pm by mustang_lex »
Logged
Alex
www.stangette.com/showcase
my Coppermine Gallery!

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #3 on: June 08, 2005, 12:26:49 am »

I am sooo lost.  What do you put in the HTML document to pull up the randomimages.php we created earlier?

UPDATE: I got it to  work. I missed changing /cpg to mine /showcase . and it works now.

Where can I get different varibles (setup of thumbnails ect.)

also I found it slow to do. Is there a faster way.
my .htaccess has

Quote
Options +Includes
XBitHack on
chmod +x index2.html

Is there something different I should do


You don't need the chmod in the .htaccess file...  You just need to do it to the file once...

I don't understand what you mean by "slow" and by "variables"?

You can do anything the documentation says you can do...  just pick the function...
http://cpmfetch.fistfullofcode.com/projects/copperminefetch/docs.php

As for slow... you really only need to create the include file once, then you can use it anywhere on your web site.  If you still think that is slow, try coding up all the sql and formatting code and inserting that... I think you underestimate how much time this is saving you









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

mustang_lex

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 34
    • Stangette.com
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #4 on: June 08, 2005, 02:00:56 am »

Ya it only happened once . Every other time it was fast. Thank you for the assistence. Its greatly appreciated!!!!
Logged
Alex
www.stangette.com/showcase
my Coppermine Gallery!

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #5 on: June 08, 2005, 04:45:33 am »

Ya it only happened once . Every other time it was fast. Thank you for the assistence. Its greatly appreciated!!!!

Well, thats good to know.  The delay would be one or more of the following things:

1. PHP Engine / Webserver is overloaded
2. Internet Congestion in getting the images
3. MySQL database slowing for some reason

None of which I can take credit for :)

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

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Thoughts on a time based picture changer
« Reply #6 on: June 21, 2005, 05:47:45 am »


Background: the concept of making a page randomly grab and change the image shown every x days was posed in a different thread.  Here are my thoughts on doing it.

I guess this would work for an SSI, or normal PHP page...

Here is what you would do in PHP either as an SSI Include or directly on your page

* Check for the existance of a data file in that directory
 file_exists ( string filename );

* If there is no file, or the date stamp on the file is older than x days:
stat ( string filename ) or fstat (file pointer)

* Grab the name of the image from CpmFetch
You will need to cpm_setReturnType("html") so you can grab it into a variable

* Write the name to a data file

* Use that name to show the image

* IF the file was within the date range

* Read the contents of the file, which is the image to be displayed

Yeah, thats it.  Crazy enough that it just might work.  Not sure why you would want to... but thats how, in a nutshell to do it...










« Last Edit: June 21, 2005, 05:58:08 am by vuud »
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

Gary B

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Hagerty High School
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #7 on: November 26, 2005, 08:15:02 am »

Ok I have the cftest.php working with no errors but I am not doing something right with getting it into an HTML page. I have the following in my randomimages.php file

<?php
include "./coppermine.php";
$objCpm = new cpm('/library');
$objCpm->cpm_viewLastAddedMedia(4,2);
$objCpm->cpm_close();
?>

Coopermine is installed in a folder called library cpmfetch is installed in a folder named cpmfetch

When I try and run the randomimages.php I get the following error messages:

Warning: main(./coppermine.php): failed to open stream: No such file or directory in public_html/cpmfetch/randomimages.php on line 2
Warning: main(./coppermine.php): failed to open stream: No such file or directory in public_html/cpmfetch/randomimages.php on line 2
Warning: main(): Failed opening './coppermine.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in public_html/cpmfetch/randomimages.php on line 2
Fatal error: Cannot instantiate non-existent class: cpm in public_html/cpmfetch/randomimages.php on line 3

I did remove two directories that seemed to show my account name for that area...but other than that this is what I see....

Help!

and Thanks!
Gary




Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #8 on: November 26, 2005, 05:44:39 pm »


According to what you told me, your:

include "./coppermine.php";

should really be

include "./cpmfetch/cpmfetch.php";

The ./ may need to be changed depending on where you are calling it from.  But you should be able to see your problem there.


Ok I have the cftest.php working with no errors but I am not doing something right with getting it into an HTML page. I have the following in my randomimages.php file

<?php
include "./coppermine.php";
$objCpm = new cpm('/library');
$objCpm->cpm_viewLastAddedMedia(4,2);
$objCpm->cpm_close();
?>

Coopermine is installed in a folder called library cpmfetch is installed in a folder named cpmfetch

When I try and run the randomimages.php I get the following error messages:

Warning: main(./coppermine.php): failed to open stream: No such file or directory in public_html/cpmfetch/randomimages.php on line 2
Warning: main(./coppermine.php): failed to open stream: No such file or directory in public_html/cpmfetch/randomimages.php on line 2
Warning: main(): Failed opening './coppermine.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in public_html/cpmfetch/randomimages.php on line 2
Fatal error: Cannot instantiate non-existent class: cpm in public_html/cpmfetch/randomimages.php on line 3

I did remove two directories that seemed to show my account name for that area...but other than that this is what I see....

Help!

and Thanks!
Gary





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

Gary B

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Hagerty High School
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #9 on: November 26, 2005, 07:04:16 pm »

Thanks!! Because of your help I have a random image now displaying. I know I read it somewhere but how do I change the size of the thumbnail displayed to the intermediate photo or normal photo and also how to get rid of he border?

Thanks so very much!
Gary
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #10 on: November 26, 2005, 08:01:17 pm »

Thanks!! Because of your help I have a random image now displaying. I know I read it somewhere but how do I change the size of the thumbnail displayed to the intermediate photo or normal photo and also how to get rid of he border?

Thanks so very much!
Gary

All that is handled through the options array:

http://www.fistfullofcode.com/projects/copperminefetch/manual/ch06.html

The border is set by your browser but can be overridden through HTML CSS stuff.  This example does not do that, but does some neat stuff with the borders and you can probably use it as a starting point to remove the borders all together.

http://www.fistfullofcode.com/projects/copperminefetch/tips.php

Hope this helps
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

Gary B

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Hagerty High School
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #11 on: November 27, 2005, 03:21:55 am »

Ok so I am impaired with PHP...but I am trying to learn...

I have the following saved as test1.css saved in the cpmfetch folder

<style type="text/css">
.test1 {  border-style:none }
</style>

I have the following saved as randomimages.php in the same cpmfetch folder

<?php
include "cpmfetch.php";
$objCpm = new cpm('/library');
$objCpm->cpm_viewRandomMedia(4,1,array("tablestyle" => "test1","imagestyle" => "test1"));
$objCpm->cpm_close();
?>

So far I can not get it to see the css file....and I still have borders...also can you tell me what line I need to add to get it to display the intermediate sized photos?


WAIT...I just figured out the display size....the following seems to display a random image of 200px wide...

<?php
include "cpmfetch.php";
$objCpm = new cpm('/library');
$objCpm->cpm_viewRandomMedia(1,1,array("tablestyle" => "test1",'imagewidth' => '200',"imagestyle" => "test1","imagesize" => "int"));
$objCpm->cpm_close();
?>


I guess all I need to figure out now is still how to rid myself of the borders.
Thank you once again!
Gary

« Last Edit: November 27, 2005, 03:35:56 am by bungargp »
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #12 on: November 27, 2005, 05:18:22 am »


Well, the imagewidth does not select an image that is 200px wide, but instead instructs the browser to render them at 200px wide.  Browsers are not as bad as they used to be at that (the first web browsers out were awful at that).

As for the CSS, you still need to tell your web page to load that CSS file.  I am not sure if you did that...

Something like this:
<link rel="stylesheet" type="text/css" href="http://....whatever ure here...." />

The css entries into cpmfetch just tells cpmfetch what to include as the class statement.

Hopefully that fixes you.

Vuud



Ok so I am impaired with PHP...but I am trying to learn...

I have the following saved as test1.css saved in the cpmfetch folder

<style type="text/css">
.test1 {  border-style:none }
</style>

I have the following saved as randomimages.php in the same cpmfetch folder

<?php
include "cpmfetch.php";
$objCpm = new cpm('/library');
$objCpm->cpm_viewRandomMedia(4,1,array("tablestyle" => "test1","imagestyle" => "test1"));
$objCpm->cpm_close();
?>

So far I can not get it to see the css file....and I still have borders...also can you tell me what line I need to add to get it to display the intermediate sized photos?


WAIT...I just figured out the display size....the following seems to display a random image of 200px wide...

<?php
include "cpmfetch.php";
$objCpm = new cpm('/library');
$objCpm->cpm_viewRandomMedia(1,1,array("tablestyle" => "test1",'imagewidth' => '200',"imagestyle" => "test1","imagesize" => "int"));
$objCpm->cpm_close();
?>


I guess all I need to figure out now is still how to rid myself of the borders.
Thank you once again!
Gary


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

Gary B

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Hagerty High School
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #13 on: December 12, 2005, 12:11:11 am »

Ok so I never got the style sheet info to work...all I want to do is to have the text displayed as Arial 10pt. Here is the code I am using so far...can I just add some sort of font tag to this code to make it arial 10?

Code: [Select]
<?php 
include "cpmfetch.php";
$objCpm = new cpm('/library');
$objCpm->cpm_viewRandomMedia(1,1,array("tablestyle" => "test1","subtitle" =>"This photo is from the %a album","imagesize" => "thumb","imagestyle" => "test1"));
$objCpm->cpm_close(); 
?>

Thanks for your help and patience!
Gary
Logged

yuvalr

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #14 on: January 16, 2006, 09:18:23 am »

I am sure I am very close to make it work but something is missing.
all I want is to display some pictures in my html pages.
i have done the following:
Installed cpfetch, checked that the cpmtest.php is working, created the  randomimages.php, and  checked that this is also working.
the next step is a bit unclear - i have created a new file and inserted the line as described:
<!--#include virtual="./gallery/cpmfetch/ssitest.php" -->
where gallery is my coppermine dir and cpmfetch is of course  my cpmfetch dir.

 i want to add the ".htaccess" but I doubt my ISP will give me permission .
saving  the file as  .shtml lead to the following result:
Error processing SSI file

Please help

 

Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #15 on: January 20, 2006, 09:41:04 pm »

I am sure I am very close to make it work but something is missing.
all I want is to display some pictures in my html pages.
i have done the following:
Installed cpfetch, checked that the cpmtest.php is working, created the  randomimages.php, and  checked that this is also working.
the next step is a bit unclear - i have created a new file and inserted the line as described:
<!--#include virtual="./gallery/cpmfetch/ssitest.php" -->
where gallery is my coppermine dir and cpmfetch is of course  my cpmfetch dir.

 i want to add the ".htaccess" but I doubt my ISP will give me permission .
saving  the file as  .shtml lead to the following result:
Error processing SSI file

Please help


I'd check the error logs... or your access log file if they log to there...

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

radmofo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #16 on: February 03, 2006, 02:25:59 am »

Hello I can't seem to find a better place to put this question so I hope here is OK. I have installed some of your code and it's visible on my SITE and it works great! There is only one thing that is strange, it will not pull random (or any) images from albums above number 25. If I force it to ViewRandomImageFrom (1,1,"album=26") or 27 28 etc I get nothing however 1-25 work perfect. I have racked my head on the wall long enough, any suggestions?

Kevin
Logged
Please give me some negative Karma. :)

iblazed

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #17 on: April 30, 2006, 12:45:28 am »

I have troubleshooted countless hours trying to get this to work and I feel like I almost have it. I got the cpmtest.php working. Also created randomimages.php, and that is also working.
I inserted the line <!--#include virtual="photos/cpmfetch/randomimages.php" -->
in my html file where I want the pictures to show up but instead of pictures I get this
cpm_viewLastAddedMedia(4,2); $objCpm->cpm_close();?>

Here is the code in my randomimages.php
<?php
include "./cpmfetch.php";
$objCpm = new cpm('/photos');
$objCpm->cpm_viewLastAddedMedia(4,2);
$objCpm->cpm_close();?>

I also edited the .htaccess file as needed.
Any help would be appreciated as I am at a loss here. Thanks
Logged

mottaguedes

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 12
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #18 on: May 19, 2006, 11:46:40 pm »

Hi everyone!

I installed cpmfetch and got to pass all the tests BUT!, I am not seeing the little grid with images.
Instead I get the following messge:


Quote
Trying to display some images:

Your installation seems correct so far, you should see a small grid of thumbnails from your gallery

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

I've been looking hard in Cpmfetch documentation but with no luck.
Can anyone shed some light please?

Thanks!!!
Logged
MottaGuedes

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CpmFetch - Using CpmFetch on HTML pages via SSI
« Reply #19 on: May 20, 2006, 12:19:56 am »

Hi everyone!

I installed cpmfetch and got to pass all the tests BUT!, I am not seeing the little grid with images.
Instead I get the following messge:


I've been looking hard in Cpmfetch documentation but with no luck.
Can anyone shed some light please?

Thanks!!!

Oh my.  That does not sound good.  Maybe the README that came with it can help...

vuud

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] 2   Go Up
 

Page created in 0.032 seconds with 19 queries.