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.
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
@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. :)
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...
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.
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
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)
- Tutorial for Adding a Random Image in the WordPress Sidebar (http://www.melissamanske.com/?p=256)
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)
- Tutorial for Adding a Random Image in the WordPress Sidebar (http://www.melissamanske.com/?p=256)
Thank you much!!!!
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? :'(
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
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 :'(
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
vuud i can't understand what you are talking about... :'(
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.
well actually the cpmfetch path is correct and also both the include and the class path are correct... ;D
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... :(
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.
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.
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 ;)
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";
vuud i just love you ;D :D :-*
only last thing: how can i set a maximun width&height for the images?
many thanks! :-*
Quote from: ardyp on April 05, 2007, 03:38:48 PM
vuud i just love you ;D :D :-*
only last thing: how can i set a maximun width&height for the images?
many thanks! :-*
You can't. Not that I know of anyway... maybe something via css?
it's strange, actually in melissa's blog she setted maximum dimension for the images:
http://www.melissamanske.com/
on my blog the photos are all 400*300... :'(
Quote from: ardyp on April 05, 2007, 06:27:47 PM
it's strange, actually in melissa's blog she setted maximum dimension for the images:
http://www.melissamanske.com/
on my blog the photos are all 400*300... :'(
Can you point to where you are seeing this? I am very interested in how she does it.
just click the link, on the right there is first "about" and then "Random Photo"
as you can see the thumbs are something like 100*100 ???
Quote from: ardyp on April 05, 2007, 08:08:38 PM
just click the link, on the right there is first "about" and then "Random Photo"
as you can see the thumbs are something like 100*100 ???
That's because that is the size of the images... something that gets set in CPG's config.
She has no additional settings on those images
ok thanks a lot, i m just making my thumbs littler... ;D
Quote from: ardyp on April 05, 2007, 08:48:23 PM
ok thanks a lot, i m just making my thumbs littler... ;D
You can set CpmFetch to tell the browser to scale your thumbs smaller or larger...
Basically like setting the height and width on the image tag (but it is not a max setting, it is a make-it-this setting)
??? ::)
and how can i do that? ;D
Quote from: ardyp on April 05, 2007, 09:38:10 PM
??? ::)
and how can i do that? ;D
See the imageheight and imagewidth settings on this page
http://cpmfetch.fistfullofcode.com/docs/manual_1.6/ch06s02.html
If you are going to ask me how, then start here:
http://cpmfetch.fistfullofcode.com/docs/manual_1.6/index.html
Read till the end.
For those that need help with it, to get the small sized random photo:
How to make your photos in your WordPress sidebar small enough to fit and look nice!
1. Login to your photo gallery Coppermine Administrator account
2. Click Config button
3. Go down to Files & thumbnails settings
4. Max dimension of a thumbnail: choose something small that will fit in your sidebar. I have 150
5. Use dimension ( width or height or Max aspect for thumbnail): Choose Max Aspect
6. Click Save New Configuration button on the bottom
Note: This will be the size of all of your thumbnails in your album. If this changed the size of your thumbnails and now your thumbnails look a little 'messed up' you can fix them in Admin Tools. Make all appropriate backups before proceeding though! :)
How to resize thumbnails so they look normal again
1. Login to your photo gallery Coppermine Administrator account
2. Click Admin Tools button
3. Choose: Update thumbs and/or resized photos (1). AND What should be updated (2): Choose Only thumbnails
4. Scroll to bottom. Select All Albums (3). Click Submit (4).
5. On next page if not all thumbnails are done click button Process more images. Repeat if more images need to be processed.
(My last post is the way *I* fix the image size in the WordPress sidebar -- you can also do it though CpmFetch as Vuud said!) :)
Great!
I finally resolved all my problems, i love you all man, many many thanks from Italy!!!! :-* ;D