Results 1 to 2 of 2

Thread: image names are causing problems for background inmage

  1. #1
    Join Date
    Nov 2011
    Thanked 0 Times in 0 Posts

    Default image names are causing problems for background inmage

    i have images set as backgrounds i a div ( thanks to Beverley )

    <style type="text/css">
    	width: 130px;
    	height: 130px;
    	background: no-repeat scroll center center transparent;
    	margin: 3px;
    	text-align: center;
    	border-right-width: 1px;
    	border-bottom-width: 1px;
    	border-right-style: solid;
    	border-bottom-style: solid;
    	border-right-color: #666;
    	border-bottom-color: #333;
    .prod-div img{

    PHP Code:
    <a href="../images/uploads/<?php echo $row_rsCustomer['image']; ?>" rel="lightbox[<?php echo $row_rsCustomer['custID']; ?>]" title="<?php echo $row_rsCustomer['custLocation']; ?>"><div class="prod-div" style="background-image:('images/uploads/thumbs/<?php echo $row_rsCustomer['image']; ?>')"/div><img width="130" height="130" /></div>

    but some images that are being uploaded have non text or numerical characters for example 042-Alexandra &amp; Steven-0411373709523.JPG">

    so are not showing in the div. i did test and if the characters are removed the images show. How can i get around this happening apart from rename all the images which isnt practical


  2. #2
    Join Date
    Mar 2005
    Thanked 3,267 Times in 3,228 Posts
    Blog Entries


    That PHP code makes invalid markup and doesn't assign a background image to anything. So the problem might not be the filenames, try:

    PHP Code:
    <a href="../images/uploads/<?php echo $row_rsCustomer['image']; ?>" rel="lightbox[<?php echo $row_rsCustomer['custID']; ?>]" title="<?php echo $row_rsCustomer['custLocation']; ?>">
    <div class="prod-div" style="background-image: url('images/uploads/thumbs/<?php echo $row_rsCustomer['image']; ?>')"></div></a>
    There could also be other problems.

    The browser cache may need to be cleared and/or the page refreshed to see changes.

    Note: In order to get the PHP code to display properly, I had to put a line break in it, that can be removed, probably should be for older browsers which could interpret it as a space.
    Last edited by jscheuer1; 07-16-2013 at 02:37 PM. Reason: format code
    - John

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Resolved Dropdown navigation causing problems.
    By X-Tream in forum CSS
    Replies: 2
    Last Post: 03-13-2013, 07:29 PM
  2. #increment code causing problems in IE
    By Daniel Thomas in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 07-15-2009, 06:30 AM
  3. Resolved Body Background image overflowing--causing unwanted scrolling.
    By JosephBergdoll in forum CSS
    Replies: 16
    Last Post: 01-13-2009, 03:06 PM
  4. PHP Header file causing problems?
    By oregonduck in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 09-21-2007, 08:42 PM
  5. More problems with my background image!
    By lord_havoc in forum CSS
    Replies: 3
    Last Post: 08-28-2007, 10:13 PM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts