Just a random image in wordpress sidebar Just a random image in wordpress sidebar
 

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

Just a random image in wordpress sidebar

Started by polle, August 25, 2006, 12:36:12 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

polle

Hi, can anyone point me in how to implement a random image from the gallery into wordpress sidebar ?

I do really dont want any other multiple unlimited features, I just want that.

Thanks in advanced.

vuud

Quote from: polle on August 25, 2006, 12:36:12 AM
Hi, can anyone point me in how to implement a random image from the gallery into wordpress sidebar ?

I do really dont want any other multiple unlimited features, I just want that.

Thanks in advanced.

I've just recently started tinkering with wordpress, but it seems to me that you would just put the cpmfetch php code into your template.  When I look at the default theme,  there is a file named sidebar.php (in wp-content/themes/default)

The only trick is going to be how to point your include statement for cpmfetch so that it goes from where the php is executed from.  I am guessing the path would be as it is from the root of your wordpress directory. 

Should work fine... I think.

Vuud

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

Tranz

@polle: This is the code that I have at my blog, http://takethu.com/blog/

In your theme's sidebar.php:
<li>
<h2><?php _e('Random photo'); ?></h2>
<div align="center">
<?php
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/");
$options = array( 'subtitle' => '%t');
$objCpm->cpm_viewRandomMedia(1,1$options); 
$objCpm->cpm_close();
?>

</div>
</li>


You would need to modify the paths in the code to match your own installation of the applications.

It was thanks to this post that I thought about putting a random image in my wordpress blog. :)

Thanks to vuud for this great mod. I'm very impressed. :)

vuud

Quote from: TranzNDance on September 09, 2006, 05:55:14 PM
@polle: This is the code that I have at my blog, http://takethu.com/blog/

... snip ...

It was thanks to this post that I thought about putting a random image in my wordpress blog. :)

Thanks to vuud for this great mod. I'm very impressed. :)

Thanks, and thank you for your work on CPG - without which CpmFetch would be pointless :)

I hope to spend time and develop plugins for the various CMS systems... or modules, whatever...  Someday... someday...


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

Jr. tristan

Further to your advice, I have installed 1.9.5. As it is related to wordpress, I post my enquiry here.

The cpmfetch folder was uploaded to a path like this http://www.yourname.net/cpmfetch/
The cpmfetch/install.php runs well displaying with all required images.


I am currently using similar code in http://www.yourname.net/blog/wp-content/...inshort/sidebar.php which is a completely different folder from above. I run the sidebar.php, it displays "Warning: main(./cpmfetch/cpmfetch.php) [function.main]: failed to open stream: No such file or directory". I guess I have installed the folder under an unsuitable folder or the path in the following code was not correct. Please help, I get lost.

<h2><?php _e('Random photo'); ?></h2>
<div align="center">
<?php
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/");
$options = array( 'subtitle' => '%t''imagewidth' => '120');
$objCpm->cpm_viewRandomMedia(1,1$options); 
$objCpm->cpm_close();
?>

</div>
</li>



Moreover, I want to replace "imagewidth" with "Max aspect for thumbnail". Please suggest the strings or code that I have to use. I am sorry to post 2 questions here, but they relate to the same code above.

vuud

Quote from: Jr. tristan on January 06, 2007, 06:48:45 AM
Further to your advice, I have installed 1.9.5. As it is related to wordpress, I post my enquiry here.

The cpmfetch folder was uploaded to a path like this http://www.yourname.net/cpmfetch/
The cpmfetch/install.php runs well displaying with all required images.


I am currently using similar code in http://www.yourname.net/blog/wp-content/...inshort/sidebar.php which is a completely different folder from above. I run the sidebar.php, it displays "Warning: main(./cpmfetch/cpmfetch.php) [function.main]: failed to open stream: No such file or directory". I guess I have installed the folder under an unsuitable folder or the path in the following code was not correct. Please help, I get lost.

<h2><?php _e('Random photo'); ?></h2>
<div align="center">
<?php
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/");
$options = array( 'subtitle' => '%t''imagewidth' => '120');
$objCpm->cpm_viewRandomMedia(1,1$options); 
$objCpm->cpm_close();
?>

</div>
</li>



Moreover, I want to replace "imagewidth" with "Max aspect for thumbnail". Please suggest the strings or code that I have to use. I am sorry to post 2 questions here, but they relate to the same code above.



I have not used Wordpress beyond a quick evaluation, but if your wordpress is in the root of your web site and cpmfetch... oh wait.

In the dev version, the syntax to start cpmfetch has changed.

$objCpm = new cpm("./cpmfetch/cpmfetch_config.php");

Not sure why it would give that error, but its definately wrong I think

Anyway, what do you mean by max aspect for thumbnail... Don't think I put anything in for that...

Vuud
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

h2ocello

Add a random image from your Coppermine Photo Gallery into your WordPress Blog sidebar in 3 easy steps.
This tutorial uses: WordPress v2.1 and CpmFetch v1.9.12 (development version)




vuud

Quote from: h2ocello on April 01, 2007, 11:58:12 PM
Add a random image from your Coppermine Photo Gallery into your WordPress Blog sidebar in 3 easy steps.
This tutorial uses: WordPress v2.1 and CpmFetch v1.9.12 (development version)




Thank you much!!!!


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

ardyp

hello there,

i got my cpm gallery installed in:

http://lnx.ardyp.com/foto/

my blog is:

http://lnx.ardyp.com/blog/

actually i got this problem:



Fatal error: Cannot instantiate non-existent class: cpm in /web/htdocs/www.ardyp.com/home/blog/wp-content/themes/3ColumnK2-0.9.5.2/app/modules/php.php(7) : eval()'d code on line 5

does anyone can help me? :'(

vuud

Quote from: ardyp on April 03, 2007, 07:49:51 PM


Fatal error: Cannot instantiate non-existent class: cpm in /web/htdocs/www.ardyp.com/home/blog/wp-content/themes/3ColumnK2-0.9.5.2/app/modules/php.php(7) : eval()'d code on line 5

does anyone can help me? :'(



Your include statement does not include a valid path to cpmfetch.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

ardyp

Quote from: vuud on April 03, 2007, 08:34:17 PM


Your include statement does not include a valid path to cpmfetch.php

how can i solve the problem? i'm not really able with php... :-X :'(

vuud

Quote from: ardyp on April 03, 2007, 08:38:12 PM
how can i solve the problem? i'm not really able with php... :-X :'(

You can put in a valid path into your include statement.  Since I have no idea what your include statement looks like, I cannot tell you how to fix it.

Post your include and I will make wild guesses
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

ardyp

vuud i can't understand what you are talking about... :'(

vuud

Quote from: ardyp on April 04, 2007, 10:37:25 AM
vuud i can't understand what you are talking about... :'(

In the code you copy and pasted there is a php include statement.

The path that it has to cpmfetch.php is wrong for your case.  You need to make sure it points to the correct place.

You may need to learn a little PHP to work through this. 
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

ardyp

well actually the cpmfetch path is correct and also both the include and the class path are correct... ;D

ardyp


vuud

Quote from: ardyp on April 05, 2007, 12:45:02 AM
well actually the cpmfetch path is correct and also both the include and the class path are correct... ;D

Well, no.  No they are not.

Fatal error: Cannot instantiate non-existent class: cpm in /web/htdocs/www.ardyp.com/home/blog/wp-content/themes/3ColumnK2-0.9.5.2/app/modules/php.php(7) : eval()'d code on line 5

This proves 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

vuud

Quote from: ardyp on April 05, 2007, 12:48:11 AM
i mean i got this situation:

gallery:

http://lnx.ardyp.com/foto/


wp:

http://lnx.ardyp.com/blog/


cpmfetch.php  and the rest:

http://lnx.ardyp.com/foto/cpmfetch/


it's also strange that if i go to http://lnx.ardyp.com/foto/cpmfetch/install.php  it works... :(

The install works because the include statement in there is one I set that says "look in the same directory". 

Post the include statement you have in your wordpress and I will tell you why it is wrong.
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

ardyp

if you mean the code that i insert in sidebar.php is this one:


<li>
<h2><?php _e('Random photo'); ?></h2>
<div align="center">
<?php
  
include "http://lnx.ardyp.com/foto/cpmfetch/cpmfetch.php";
  
$objCpm = new cpm("http://lnx.ardyp.com/foto/cpmfetch/cpmfetch_config.php");
  
$objCpm->cpm_viewLastAddedMedia(1,4);
  
$objCpm->cpm_close();
?>

</div>
</li>



thanks vuud  ;)

vuud

Quote from: ardyp on April 05, 2007, 11:25:48 AM
if you mean the code that i insert in sidebar.php is this one:


<li>
<h2><?php _e('Random photo'); ?></h2>
<div align="center">
<?php
  
include "http://lnx.ardyp.com/foto/cpmfetch/cpmfetch.php";
  
$objCpm = new cpm("http://lnx.ardyp.com/foto/cpmfetch/cpmfetch_config.php");
  
$objCpm->cpm_viewLastAddedMedia(1,4);
  
$objCpm->cpm_close();
?>

</div>
</li>



thanks vuud  ;)

Yeah, your include is wrong.  Try:

  include "../foto/cpmfetch/cpmfetch.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