Skip to main content

How to add a photo gallery using PHP

phpscript A PHP enhanced photo album script that automates retrieval of all images within a specific directory to show with pagination links to cycle through each page. The script is placed within a desired image directory that automatically derives the file names of all images within it and creates a JavaScript array for further processing. As you upload or modify images within the directory, the script will automatically adapt and allows you to update your gallery with ease.

Click here to see the demo

Steps to follow:

1. Login to your Blogger Dashboard and navigate to Layout > Edit HTML

2. Insert the following section code below right after this section code here: ]]></b:skin>

<script type="text/javascript" src="http://www.mysite.com/myimages/getalbumpics.php?id=templates"></script>

<script type="text/javascript">
//Optional, manual description for particular pictures inside album
//Syntax: albumid.desc[index]="Picture description here"
//eg: templates.desc[2]="This is description for the 3rd picture in the album"
//eg: templates.desc[6]="This is description for the 7th picture in the album"
</script>

<script type="text/javascript" src="ddphpalbum.js">
/*********************************************
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ *********************************************/
</script>

<link rel="stylesheet" type="text/css" href="ddphpalbum.css" />

Note: The above references getalbumpics.php, ddphpalbum.js, and ddphpalbum.css files. In which you will need to right click and save to upload to your own server. Keep in mind that you will need to add the .php file in a separate folder, the folder where your album images are located.

Configuration for the above section code

- The section code in blue that is underlined should be changed to the link where you PHP script and album images are located. At the end of the link, you see “templates”, this is the name of your folder and should be modified to fit yours. *Words not underlined should not be modified.

- The words in green is your folder name, where your script and images are located.

- Numbers in red represents image order and words in bold is your picture description, which can be modified.

3. Navigate over to Page Elements under the Layout tab to add an HTML/JavaScript gadget and copy/paste the following section code below in the box.
<script type="text/javascript">

new phpimagealbum({
    albumvar: templates, //ID of photo album to display (based on getpics.php?id=xxx)
    dimensions: [2,5],
    sortby: ["file", "asc"], //["file" or "date", "asc" or "desc"]
    autodesc: "", //Auto add a description beneath each picture? (use keyword %i for image position, %d for image date)
    showsourceorder: false, //Show source order of each picture? (helpful during set up stage)
    onphotoclick:function(thumbref, thumbindex, thumbfilename){
        thumbnailviewer.loadimage(thumbref.src, "fit2screen")
    }
})

</script>
Configuration for the above section code

- Under albumvar: – change “templates” to that of your folders name containing the script and images

- Dimensions: 2 = columns and 5 = rows, these numbers should be modified to fit your template.

** Tutorial completed

Comments

Popular posts from this blog

How to add a calendar icon as date header

From this tutorial, you will be able to add your very own calendar icon to your blogger! If you’re going to show the date on every post, why not do it with a little style and make it a little more appealing to viewers? If you want your calendar icon to appear on every post, read Blogspot Vision’s post on how to do that by clicking here to go to the post. Let’s get started but first and foremost, make sure you back-up your existing template, just in case it doesn’t turn out as expected. Steps to follow:1. Login to your Blogger dashboard2. Go to Layout > Edit HTML (Click on “expand widgets” box)3. Search for the following section code: ]]></b:skin>
and add the following section code below right before it:.post .date {
    height: 50px;
    width: 45px;
    background: url(http://www.blogspotvision.com/bspotvision/itheme-calendar.gif) no-repeat;
    font: normal 22px Arial;
    color: #666666;
    text-align: center;
    …

CSS DIV boxes with drop shadows

This example shows how to add a drop shadow style to any container element using CSS. It does this by wrapping the desired content in a DIV with its background color set to a color of the desired color for the shadow. Another DIV is set for your content and is shifted slightly upwards and to the left to expose the shadow. The "master" DIV wraps it all up but is shifted to the right and downwards, returning the entire markup to it's original page position.

IE6 is not compatible with this example, but you can apply conditional HTML to hide the effect in that browser. In contrast, IE7 is compatible with this example for finally updating to proper CSS.

Note: If you will be using an image for your content, you should give ".shadowcontainer" an explicit height, reflecting that of the image's for fixed and set location when viewed.



CSS Code
<![if !IE 6]>
.shiftcontainer{
position: relative;
left: 5px; /*Number should match -left shadow depth below*/
top: 5px;…

How To Show The Post Date On Every Post

From this tutorial, you will be able to show the post date on every last one of your posts. As we all know, Blogger’s default templates only show a single date for every post that was posted that day. Some readers will find it convenient to have that quick glance at the date on each post, but some will not even notice. This tutorial is definitely handy if you plan to use a calendar icon as your post date, since the timestamp can be modified. As always, make sure you download your current existing template just in case it doesn’t turn out as expected.

Steps to follow:
1.Login to your Blogger dashboard.
2. Go to Layout > Edit HTML (click on “expand widgets” box)
3. Now search for the red line of code or similar code:Note: If you can’t seem to find the line in red, try the second section code in blue.<div class='post-feeds'>
<b:loop values='data:posts' var='post'>
<b:if cond='data:post.dateHeader'>
<h2 class='date-header'>
<da…