Tip: How to add CpmFetch into Html Tip: How to add CpmFetch into Html
 

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

Tip: How to add CpmFetch into Html

Started by emjay_smitten, January 27, 2010, 09:40:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

emjay_smitten

I wanted to put 1 image into www.mywebpage.html that is like an intro for my site http://www.haiticontacts.com. It took me one whole day to find out why it did not show, as many people say it only works on .php

Finally this morning I figured it out and is actually quite easy.

In your webhost most of the time you can get access to apache handlers. If you can here is what you need to do:

for example click on Add Apache Handler.
Then put as Apache handler AddHandler application/x-httpd-php5
Then put .html .htm as the type of webpage that need to handle the php.

It will tell your webhost server to handle php in html pages. If you cannot you can make a file called .htaccess in notepad. Add the suggested line in there and upload into the root of your hosing account.

Then in www.mywebpage.html I add:

<?php
  include "./pictures/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./pictures/cpmfetch/cpmfetch_config.php");
  $options = array ('imagesize' => 'large' );
  $objCpm-> cpm_viewLastAddedMedia(1,1, $options) ;
  $objCpm-> cpm_viewLastAddedMedia(1,4) ;
  $objCpm-> cpm_close();
?>

This will show 1 image in large from the last added media.
And 4 thumbs underneath.

Now all I need to do is get rid of the border (this I see in the forum somewhere) , do some layout and find out how to get a random image instead of LastAddedMedia.

I hope this can help somebody. But for now, this sweet program is doing what it says!!! TOP

Joachim Müller

#1
In other words, you instructed your webserver to parse all HTML files on your server with the PHP parser. Of course you can do that, but there are several reasons why you shouldn't:

  • Processing of plain HTML pages will get slower
  • Resources consumption on your server will increase
  • Your webhost might shake the naughty finger at you

You could do the same on your client operating system as well and instruct it to fire up your word processor when a .txt file is clicked on. You just burn resources that way. But if that makes you happy, that's fine for us. Just a recommendation at others not to do that. Additionally, most webhosts won't allow you to do what you're doing.

Instead of doing what you did I suggest to undo your edit in your .htaccess file and to rename the index file in your webroot (the file that you incorrectly refered to as
Quote from: emjay_smitten on January 27, 2010, 09:40:31 AMwww.mywebpage.html
, but that actually is named index.html, i.e. http://www.haiticontacts.com/index.html) to index.php
Use your favorite FTP app to accomplish that. Takes less then a minute.
That should be all it takes. Ta-da.

emjay_smitten

Hi thanks for the tip. I tried that before and did not work but now it did. I just wanted to demonstrate that it can be done.

I do not have .htaccess in my webhostfolder. I just used the appache handlers to process php on html. You think I have to delete them to?

I know this will be off-topic so this will be the last of it. I thank you anyway for your response  ;)

Oh, you want me to close the topic or do you?


idosha

Another option is to use a .shtml website and to call a .php page using SSI <!--#include virtual="/ssi/lastadded.php" --> I personally use this solution myself.

phill104

But why? Simply do as Joachim suggests.

Anyway, closing and locking.
It is a mistake to think you can solve any major problems just with potatoes.