Skip navigation
RiaandSteve1
Currently Being Moderated

How to remove gray line around an empty image in DW CS6

Jun 11, 2013 2:08 PM

I have an image that I retrieve from a database (the path) files are stored in a folder.

However when there is no image the image outline is still there.

I have managed to remove the image dreamweaver CS6 gives you automatically (if there is an error etc.) , however the outline is still there even if you set the border to zero. When there is an image it is shown with no border

 

Is there a solution to remove the border of the empty image or remove the empty image all together

 

Please find my code I'm using below

 

<img src="<?php if (is_null($row_Recordset1['SmalImage2'])) { 

} else {

}   $file_path.$row_Recordset1['SmallImage2']; ?>" alt="<?php echo $row_Recordset1['Manufacturer']; ?> <?php echo $row_Recordset1['Model']; ?>" name="t2" width="60" height="60" id="t2" onClick="MM_swapImage('main','','<?php echo $file_path.$row_Recordset1['LargeImage2']; ?>',1)"border = "0"></td>

 
Replies
  • Currently Being Moderated
    Jun 11, 2013 3:16 PM   in reply to RiaandSteve1

    In what browser(s) are you seeing this?

    Is there link code wrapping the missing images?

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 11, 2013 3:16 PM   in reply to RiaandSteve1

    DW doesn't put any images or borders anywhere. It's the browser that does that. Some do and some don't.

     

    Try this PHP code -

     

    <?php if !is_null($row_Recordset1['SmalImage2])) { ?>

    <img src="<?php $file_path.$row_Recordset1['SmallImage2']; ?>" alt="...">

    <?php } ?>

     

    If there's no image, the <img> tag won't even be written to the page.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 11, 2013 4:34 PM   in reply to RiaandSteve1

    Dang - I make this mistake every time I do an IF conditional - code should be this:

     

    <?php if (!is_null($row_Recordset1['SmalImage2]))) { ?>

    <img src="<?php echo $file_path.$row_Recordset1['SmallImage2']; ?>" alt="...">

    <?php } ?>

     

    (don't forget to replace the placeholder in the alt attribute)

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2013 3:49 AM   in reply to RiaandSteve1

    <img src= (or was that a typo?)

     

    Preview the page, look at the source, and show us what code is being written for that tag when there is an image in the database.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2013 5:20 AM   in reply to RiaandSteve1

    Put the " back. It belongs there. I was referring to this -

     

    SafariScreenSnapz007.jpg

    You had "scr" instead of "src".

     

    Anyhow, please do what I asked about copying the source code for that image from the previewed page.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2013 8:55 AM   in reply to RiaandSteve1

    (Sorry to be a pain)

     

    You just have to make sure you read the suggestions. Please PREVIEW this page in browser so that the PHP is executed. Look at the source code. Copy the code for the image that is not appearing there. Paste that code into a reply. I want to see the code that is being written to the page by your PHP.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2013 12:44 PM   in reply to RiaandSteve1

    Thank you - so, the src attribute is not receiving a value. Let's see why.

     

    Change this -

     

    <?php if (!is_null($row_Recordset1['SmalImage2]))) { ?>

    <img src="<?php echo $file_path.$row_Recordset1['SmallImage2']; ?>" alt="...">

    <?php } ?>

     

    to this -

     

    <?php if (!is_null($row_Recordset1['SmalImage2]))) { ?>

    echo $file_path . " | " . $row_Recordset1['SmallImage2']; exit();

    <img src="<?php echo $file_path.$row_Recordset1['SmallImage2']; ?>" alt="...">

    <?php } ?>

     

    This will write that information to the screen and exit rendering at that point. What is the information that is written to the page, please?

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2013 1:53 PM   in reply to RiaandSteve1

    Right - my mistake!

     

    It should be <?php echo $file_path." | ".$row_Recordset1['SmallImage1'];exit(); ?>

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2013 2:19 PM   in reply to RiaandSteve1

    Have you tried inserting a global css code like this:

     

     

    img {

        outline: 0;

    }

     

    Not sure if this is going to work but worth a try.  If not please post a link to your page for us to try something else from our machines.

     

    Good luck.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2013 2:43 PM   in reply to RiaandSteve1

    Is that the correct path to the image? It must not be.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2013 3:03 PM   in reply to RiaandSteve1

    Excellent.  Good luck!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points