Home  | FAQ  | Search  | Memberlist  | Usergroups  | Register  | Profile  | Log in  | Log in for your private messages
Adding pictures for mybloggie 2.1.3

 
Post new topic   Reply to topic    myWebland Forum Index -> Customization
View previous topic :: View next topic  
Author Message
Canad1an
Developer


Joined: 11 Jun 2005
Posts: 83

PostPosted: Fri Jun 17, 2005 6:02 pm    Post subject: Adding pictures for mybloggie 2.1.3 Reply with quote

If you have wanted that profile picture and don't know how to add it. Here is a simple way.
This script can either display a single image or randomly select images from a folder.

There is a small amount of editing involved.

index.php

Find this code:

Code:

// Sidemenu menu items. You can change the menu item order here

include($mybloggie_root_path.'calendar.php');
include($mybloggie_root_path.'spacer.php');
include($mybloggie_root_path.'category.php');
include($mybloggie_root_path.'spacer.php');
include($mybloggie_root_path.'recent.php');
include($mybloggie_root_path.'spacer.php');
include($mybloggie_root_path.'archives.php');
include($mybloggie_root_path.'spacer.php');
include($mybloggie_root_path.'user.php');
include($mybloggie_root_path.'spacer.php');


All that code is your sidemenu. You can rearrange those in any format you want. If you are interested in adding a profile picture to it.
Add this code anywhere you want in there:

Code:
include($mybloggie_root_path.'mypic.php');



That was the hard part. Now all you have to do is created a file called:
mypic.php

And copy and paste the following code into that file:

Code:

<?
// Simple Image Displaying Script    #
// With optional random image script #
// ###################################
// Use with mybloggie 2.1.3          #
// By Matthew Adam                   #

//RANDOM IMAGE CONFIGURATION

$random = 1; // Random image on (1) or off (0)

$src = "../images/"; //folder with the images


//SINGLE IMAGE CONFIGURATION

$imgsrc = ''; //Put the link to your picture here



if ($random == 1) {

$dir=opendir("$src");
$directory=("$src");
$pattern="\.(GIF|JPG|gif|jpg|jpeg|png|bmp|swf)$";
if(!$dir)
{
die("Failed to read directory");
}
$s=readdir($dir);
$count="0";
$image;
while($s)
{
if(ereg($pattern, $s))
{
$image[$count]=$s;
$count++;
}
$s=readdir($dir);
}
closedir($dir);

//Spit it out
$limit=count($image);
$limit--;
$randNum=mt_rand(0,$limit);
echo "<img src=\"$directory$image[$randNum]\" width=\"98%\" border=0 title=\"$image\">";

} else {
echo '<img src="<? echo $imgsrc; ?>" width="98%" alt="My Picture">';
}
?>
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    myWebland Forum Index -> Customization All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
TNX?

Error. Page cannot be displayed. Please contact your service provider for more details. (1)




Powered by phpBB © 2001, 2005 phpBB Group
Contact Us