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: Just a random image in wordpress sidebar  (Read 22154 times)

0 Members and 1 Guest are viewing this topic.

polle

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Just a random image in wordpress sidebar
« 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.
« Last Edit: April 05, 2007, 04:16:28 pm by vuud »
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Just a random image in wordpress sidebar
« Reply #1 on: August 25, 2006, 03:34:53 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

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

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Just a random image in wordpress sidebar
« Reply #2 on: September 09, 2006, 05:55:14 pm »

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

In your theme's sidebar.php:
Code: [Select]
<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. :)
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Just a random image in wordpress sidebar
« Reply #3 on: September 10, 2006, 04:55:19 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...


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

Jr. tristan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Just a random image in wordpress sidebar
« Reply #4 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.
Code: [Select]
<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.
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Just a random image in wordpress sidebar
« Reply #5 on: January 06, 2007, 04:32:15 pm »

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.
Code: [Select]
<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
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

h2ocello

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 3
    • My Weblog
Adding a Random Image in the WordPress Sidebar
« Reply #6 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)



Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Adding a Random Image in the WordPress Sidebar
« Reply #7 on: April 02, 2007, 02:27:06 am »

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!!!!


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

ardyp

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: Just a random image in wordpress sidebar
« Reply #8 on: April 03, 2007, 07:49:51 pm »

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? :'(
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Just a random image in wordpress sidebar
« Reply #9 on: April 03, 2007, 08:34:17 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
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

ardyp

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: Just a random image in wordpress sidebar
« Reply #10 on: April 03, 2007, 08:38:12 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 :'(
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Just a random image in wordpress sidebar
« Reply #11 on: April 03, 2007, 11:13:51 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
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

ardyp

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: Just a random image in wordpress sidebar
« Reply #12 on: April 04, 2007, 10:37:25 am »

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

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Just a random image in wordpress sidebar
« Reply #13 on: April 04, 2007, 10:45:38 pm »

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. 
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

ardyp

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: Just a random image in wordpress sidebar
« Reply #14 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
Logged

ardyp

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: Just a random image in wordpress sidebar
« Reply #15 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... :(
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Just a random image in wordpress sidebar
« Reply #16 on: April 05, 2007, 03:20:25 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.





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
Re: Just a random image in wordpress sidebar
« Reply #17 on: April 05, 2007, 03:21:29 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.
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

ardyp

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: Just a random image in wordpress sidebar
« Reply #18 on: April 05, 2007, 11:25:48 am »

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

Code: [Select]
<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  ;)
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Just a random image in wordpress sidebar
« Reply #19 on: April 05, 2007, 03:00:56 pm »

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

Code: [Select]
<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";


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.036 seconds with 19 queries.