thesecraftonlymultiply Posted April 22, 2008 Share Posted April 22, 2008 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 https://forums.phpfreaks.com/topic/102355-echoing-an-image-with-a/ Share on other sites More sharing options...
jonsjava Posted April 22, 2008 Share Posted April 22, 2008 <?php $handle = opendir ('./thumbnails/'); while (false !== ($file = readdir($handle))) { if($file != "." && $file != ".." && $file != basename(__FILE__)) { print "<img src='./thumbnails/{$file}'>"; } } ?> Link to comment https://forums.phpfreaks.com/topic/102355-echoing-an-image-with-a/#findComment-524117 Share on other sites More sharing options...
thesecraftonlymultiply Posted April 22, 2008 Author Share Posted April 22, 2008 Thankyou! The line now reads: print "<a href='./uploadedimages/{$file}'> <img src='./thumbnails/{$file}'></a>"; ...and it works perfectly. Now how do I go about laying out the images appropriately? Can I place them either within a simple table or style them with CSS? Many thanks Link to comment https://forums.phpfreaks.com/topic/102355-echoing-an-image-with-a/#findComment-524134 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.