close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

image with text below it

Thread began 11/08/2011 5:16 am by Kumel | Last modified 11/09/2011 5:01 pm by Jason Byrnes | 1018 views | 11 replies |

Kumel

image with text below it

I have a form & there, user uploads images & then those images are displayed in small thumbs in another page, from a folder where it is uploaded to.. So is it possible to show the image name below the picture... its not like altering the image but below the image, in text field i want image name to be there..

To display image from folder i have used this code--

<?php
$counter =0;
$dirname = "Images/Thumbs/";

if(@is_dir($dirname) && @is_readable($dirname)) {
$images = scandir($dirname);
$ignore = Array(".", "..");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
$counter++;
echo "<img src='plugins/Images/Thumbs/$curimg' /><br/>
<br/>
";

}
}
}

if($counter==0){
echo" No Images Uploaded <br />
";
}

?>



So by this code the images in Images/Thumbs directory, displays the images 1 below the other.. & now i want the file name also to be displayed below the images.. so please help me on that.. :(

Sign in to reply to this post

Jason ByrnesWebAssist

this code create the image tag:

echo "<img src='plugins/Images/Thumbs/$curimg' /><br/>
<br/>
";



using $curimg as the image file name. so add that after the <br /> tag:
echo "<img src='plugins/Images/Thumbs/$curimg' /><br/>$curimg
<br/>
";

Sign in to reply to this post

Kumel

awesome..

is it possible like to cover 1 single picture with borders ? i mean image & text in a box..?

Sign in to reply to this post

Jason ByrnesWebAssist

yes, add a span tag with a border around the image and name:

<span style="border:1px solid #000">Image here<br />name here</span>

Sign in to reply to this post

Kumel

can u please paste it in above codes.. if you dont mind..

Sign in to reply to this post

Jason ByrnesWebAssist

echo "<span style='border:1px solid #000'><img src='plugins/Images/Thumbs/$curimg' /><br/>$curimg
<br/></span>
";

Sign in to reply to this post

Kumel

ok When i do that i get error like this --
Parse error: syntax error, unexpected T_STRING

these are the lines where it is showing the above error

if($counter==0){
echo" No Images Uploaded <br />"; [Showing error in this line]
}

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of the full error message and a copy of the page so i can see the code in context.

Sign in to reply to this post

Kumel

i tried again.. but now its not displaying properly.. please check the file

Attached Files
imgwithborder.zip
Sign in to reply to this post

Jason ByrnesWebAssist

  i tried again.. but now its not displaying properly  




what does this mean? is it not showing the error message now? Please be more detailed in your problem reports, am i looking for an error or something else?

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...