php random gallery
You were searching for "php random gallery". These posts might be of interest:
- No related posts.
Add Random Gallery Photo Block
Filed in: Site News — February 1st, 2005
Just installed the Gallery random photo block into the Wordpress sidebar. The so-call “installation” is easy, just use a PHP include function to include the random-block.php script into template.
However, I can’t find a way to modify the image tag so that it has a CSS border. The image tag is auto generated by $album->getThumbnailTag() function in the script. The function code will be deep inside Gallery core, I better don’t touch on it…
If you have a workaround, please let me know. Thanks!
Updated: I think I found it – The enhanced Random Photo for Gallery !
…few minutes later… No, not quite. It support CSS for the captions not for the thumbnail…
Popularity: 1% [?]
Comments Feed
TrackBack URL
February 1st, 2005 at 4:37 pm
Actually I think you don’t need to assign a class to the
imgtag. All you need to do is to add the following CSS:div#sidebar li img {padding: 3px;
border: 1px solid #CCCCCC;
}
That should add a gray border around the photo. Just change the padding, border width and colour to suit. Just a small warning – results may be funny if your code is not valid XHTML
February 1st, 2005 at 11:15 pm
Thank you, David.
But now all images in sidebar have border..
February 2nd, 2005 at 4:39 pm
Yup true, unless you can give an
idorclassto yourlitag, e.g.. Then for your CSS you dodiv#sidebar li#rand-photo img {padding: 3px;
border: 1px solid #CCCCCC;
}
March 19th, 2005 at 12:41 pm
Hi LcF, how did you get the block-random-enhanced to work?
As soon as I put “include(’gallery/block-random-enhanced.php’);” into function.php, the block_image shows up on top of the page. I tried to locate to my sidebar. Nothing works.
I added a div ID in block-random-enhanced.php, echo “
It seems like the “include” can only be added to the beginning of function.php.
Using:
function get_header() {
if ( file_exists( TEMPLATEPATH . ‘/block-random-enhanced.php’) )
load_template( TEMPLATEPATH . ‘/block-random-enhanced.php’);
else
load_template( ABSPATH . ‘gallery/block-random-enhanced.php’);
}
does not work neither.
Cheers.
March 19th, 2005 at 2:11 pm
@allan: I am not using block-random-enhanced. I use the block-random comes with Gallery.
No, you do not add the include code into function.php, add the code into your wordpress template(sidebar) instead.
Example:
<?php include("/gallery/block-random-enhanced.php"); ?>March 20th, 2005 at 1:14 pm
Hey LcF, thanks for the quick response.
I am running Gallery 1.4 and WP 1.5. The match seems problematic. Whenever I call a function in Gallery, system prints:
PHP Warning: Cannot modify header information – headers already sent by (output started at D:\root\dynamic\wp-content\themes\default\index.php:5) in D:\root\dynamic\gallery\lib\lang.php on line 342 PHP Fatal error: Cannot redeclare _() (previously declared in D:\root\dynamic\wp-includes\functions.php:6) in D:\root\dynamic\gallery\lib\lang.php on line 465
It seems some hacking of the original code is needed to get these two program to work together.
Cheers.
March 20th, 2005 at 7:36 pm
I don’t understand why do you need to call a function in Gallery?!
Login Wordpress admin, goto Presentation > Theme Editor. From there, select your template and click “Sidebar Template” and add the following code to include random gallery block:
<?php include("http://www.YOURDOMAIN.com/gallery/block-random-enhanced.php"); ?>March 21st, 2005 at 3:06 am
Hey man, guess I did my changes in different way since the very beginning. Whenever I need to refine something, I use Dreamweaver MX instead. But results are the same as template editor. System prints out the error message above. I have found no spaces, new lines, or other garbage before an opening < ?php tag or after a closing ?> tag.
It’s interesting that the “block-random.php” worked on your system out of the box with any error.
Best.
March 21st, 2005 at 3:51 am
I fixed
“PHP Warning: Cannot modify header information – headers already sent”
by turning on the “output buffering”. It speeded up my page loading speed as well. That was a surprise.
These error in original code remains:
Fatal error: Cannot redeclare _() (previously declared in D:\root\dynamic\wp-includes\functions.php:6) in D:\root\dynamic\gallery\lib\lang.php on line 465
March 21st, 2005 at 9:09 am
I would advice you to make a new installation and do as I recommended.
March 21st, 2005 at 11:26 am
To all other friends who might be looking for the answer to this issue:
The problem is that Gallery *requires* the random block to be included via HTTP. It can’t be included as a direct file.
include(”http://your.site/path/to/gallery/block-random.php”)
That way gallery works as an external system to WP. No worries about definition overlapping at code level.
May 25th, 2005 at 10:30 pm
[...] The example that is closest to what I want: size of photo and description on th ebottom is this: http://www.liewcf.com/blog/archives/2005/02/add-random-gallery-photo-block/ Research the method to create a plug in from the beginning.
[...]