Bert Vierstra Blog

Bert Vierstra Home

   
Ad

October 15, 2005

Previous : Free Web Content is Duplicate Content    Next : Google Update : Duplicate Content Penalty

Wordpress and Pictures

Filed under: Web Activities, PHP Stuff — Gede @ 6:12 pm

Ok I admit, sometimes I just start doing things that I shouldn’t do, like today. (I have better things to do, but when I have an idea well….) I have played with picture galleries for some time, made a lot of templates for them, and came across some galleries that could be integrated with Wordpress, the software that this blog runs on too. It would be nice to have Wordpress and some sort of picture gallery integrated, and maybe someday I write a famous plug in for Wordpress, that blends in perfectly.

I already have a few sites with lots of pictures, so resources enough, why not just display those for starters, to give this ugly Wordpress template some color?

First I wrote a bit of php code, that pulls a random picture from the MySql database, and formats this with the link to the page where the picture is from:

Something like this:

$query = "SELECT * FROM `picture_table` ORDER BY RAND() LIMIT 1";

etc..

The php page just prints out the picture html:

<a href="http://websitelink" target="_blank"><img src="http://websitepicture.jpg" width="x" height="x" border="0" alt="alt text of picture"></a>

Ofcourse I could use an Iframe to display the picture in Wordpress:

<iframe src="http://www.bali-information.com/proprand.php" height="120" width="120" scrolling="no" frameborder="0" title="random picture">
</iframe>

But I made a bit of php code, that reads the output of the script and prints it to the template:

<?
$fd = fopen ("http://www.bali-information.com/proprand.php", "r");
if (!$fd) {
while (!feof ($fd)) {
$coll = $coll . fgets($fd, 1024);
}
fclose ($fd);
print $coll;
?>

I added this bit of php to the sidebar.php and voila, random pictures in Wordpress from another site.

Please feel free to use my pictures in your Blog ;)

Here is the link:

http://www.bali-information.com/proprand.php

If traffic becomes too high I will block your IP address…

Technorati Tag

No Comments

No comments yet.

Leave a comment

You must be logged in to post a comment.




Categories:

Random Thoughts
Web Observations
Web Activities
Digital Camera Department
PHP Stuff
Internet Marketing
Windows XP
Mobile Phones
Panorama Pictures


Archives:

September 2006
May 2006
February 2006
October 2005
July 2005
June 2005
May 2005


My Sites

Bali Web Home
BPI Properties in Bali
Bali Hotels Lovina
Panotools 360
Bali News and Info
Lovina Bali Spa
Bali Golf House
Bert Vierstra
Malaysia Pictures
de Praktijk
Camera Land Shop




Login



XML Feed

RSS






- Bali Web Design Indonesia -

The Web Writers Writings - WordPress -