Very new to code and need a little guidence

Hi all hopefully you can help with the most likely easy problem I have.

I brought a HTML template website so I could host my photos. At the time I knew nothing about HTML but after a few weeks got it all sorted how I wanted it to look.

Now this as you can guess meant if I wanted to add a new picture I would have to add the HTML code for each file!!

I then found using PHP I could not only have it auto generate a gallery but make the thumbnails for me. So i’m trying to convert things over and use this code I found. For the most part I’m all sorted but there is one little section I can’t work out.

Here is how the HTML looks

[code]

[/code]

Heres the bit of code I’m trying to integrate. (Mostly the echo part)

[php]

        /** settings **/

$images_dir = ‘images/portfolio/Draft2/Popup/’;
$thumbs_dir = ‘images/portfolio/Draft2/Grid/’;
$thumbs_width = 99;
$images_per_row = 1;

/** generate photo gallery **/
$image_files = get_files($images_dir);
if(count($image_files)) {
$index = 0;
foreach($image_files as $index=>$file) {
$index++;
$thumbnail_image = $thumbs_dir.$file;
if(!file_exists($thumbnail_image)) {
$extension = get_file_extension($thumbnail_image);
if($extension) {
make_thumb($images_dir.$file,$thumbnail_image,$thumbs_width);
}
}
echo ‘<a href="’,$images_dir.$file,’" ';
if($index % $images_per_row == 0) { echo ‘

’; }
}
echo ‘
’;
}
else {
echo ‘

There are no images in this gallery.

’;
}

[/php]

This is the section I’m having trouble adding.

[php]

  • [/php]

    I’m kind of at a loss of were to go to get it working. I think I have given everything need but let me know if I missed anything.

    Thanks for looking

  • Sponsor our Newsletter | Privacy Policy | Terms of Service