Jump to content

Recommended Posts

Hello,

 

I am trying to make a picture gallery for my website but i am having a problem with the size of the pictures.

When i go to the picture gallery i want to see the pictures that i have stored in the pictures file, in a small scale and not in full resolution. My problem is that i have managed to create this picture gallery but i have failed in seeing the pictures in a small scale. So when i go to the picture gallery i see all of my pictures in full resolution. Imagine how that is. :P

 

The code i use is:

 

<?php

    $pics= ("pics/");

    $cols= 4;

 

 

    if ($handle = opendir($pics))

    {

        while (FALSE !== ($file= readdir($handle)))

        {

            if ($file != "." && $file != ".." && $file != rtrim($pics, "/"))

            {

                $files[]=$file;

            }

        }

        closedir($handle);

    }

 

$colsCtr= 0;

 

echo '<table width="100%" cellspacing="10"><tr>';

 

foreach($files as $file)

{

    if ($colsCtr%$cols == 0)

        echo '</tr><tr><td colspan="2"><hr /></td></tr><tr>';

        echo '<td align="center"><a href="' . $pics . $file . '"><img src="' . $pics . $file . '" /></a></td>';

        $colsCtr++;

}

echo '</table>' . "\r\n";

?>

 

Can some one please tell me what is wrong with the code?

 

Can you please tell me what to add or what to remove so that this works?

 

Please not that i want to see the pictures at small scale first and when i click on each picture see the full resolution.

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/215786-pic-gallery-issues/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.