Jump to content

echoing an image with a <a href link and some styling issues


Recommended Posts

Hi there!

 

Hope everyone is well.  I am in need of some further help if you do not mind.

 

I am using this code:

 

<?php
        $handle = opendir ('./thumbnails/');
        while (false !== ($file = readdir($handle))) {
            if($file != "." && $file != ".." && $file != basename(__FILE__)) {
			echo '<img src="./thumbnails/'.$file.'">';

            }
        }
?>

 

to output the images of the thumbnails directory...  I am struggling to include the link for each thumbnail as:

 

"./uploadedimages/'.$file.'"

 

I am getting very confused amongst all the single and double quotation marks!  That is my first question if anyone would be kind enough to help me?  Secondly I would like to style the images with CSS, how is this possible?  Do I just wrap a div id around the echo statement?

 

Thankyou very much in advance :)

 

Best wishes, Luke

Link to comment
Share on other sites

<?php
        $handle = opendir ('./thumbnails/');
        while (false !== ($file = readdir($handle))) {
            if($file != "." && $file != ".." && $file != basename(__FILE__)) {
			print "<img src='./thumbnails/{$file}'>";

            }
        }
?>

Link to comment
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.