Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    Regular Coder
    Join Date
    Oct 2004
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    images don't show from database

    http://mydragonflygifts.com/items.ph...Custom%20Gifts
    Click any product.

    So the images did work fine and now they don't at all. IE shows an error I don't understand and FF doesn't show an image at all.

    Anyone know what is wrong?

  • #2
    Senior Coder
    Join Date
    Apr 2005
    Location
    Colorado, United States
    Posts
    1,208
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What are you attempting to do? Load images into the database in a binary field and retreive them? Or are you taking the filenames and linking to them?

    Please clarify your request.
    "$question = ( to() ) ? be() : ~be();"

  • #3
    Regular Coder
    Join Date
    Oct 2004
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ./products/belts/t05007.jpg EXAMPLE

    I am linking to and displaying that image.

  • #4
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by tns123j
    ./products/belts/t05007.jpg EXAMPLE

    I am linking to and displaying that image.

    How about deleting the file extension, example:

    products/belts/t05007
    Leonard Whistler

  • #5
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,108
    Thanks
    11
    Thanked 101 Times in 99 Posts
    use the absolute path (preferably the correct one )

    http://mydragonflygifts.com/images/p...lts/t05007.jpg
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #6
    Regular Coder
    Join Date
    Oct 2004
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
            <img src="./images/<?php echo($row['image']); ?>" alt="<?php echo($row['name']); ?> Product Image" border="1" />
    that is my PHP. the ./images is already there.

    therefore: ./products/belts/t05007.jpg should work. right?

  • #7
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by tns123j
    PHP Code:
            <img src="./images/<?php echo($row['image']); ?>" alt="<?php echo($row['name']); ?> Product Image" border="1" />
    that is my PHP. the ./images is already there.

    therefore: ./products/belts/t05007.jpg should work. right?
    I am assuming you are using MySQL for you database.

    In your database for "image" the names you have entered should not have an extension such as .jpg. Your example should end with t05007
    Last edited by Len Whistler; 04-17-2005 at 06:39 AM.
    Leonard Whistler

  • #8
    Senior Coder
    Join Date
    Apr 2005
    Location
    Colorado, United States
    Posts
    1,208
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try getting rid of the ./ before images too.
    "$question = ( to() ) ? be() : ~be();"

  • #9
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,108
    Thanks
    11
    Thanked 101 Times in 99 Posts
    Quote Originally Posted by Len Whistler
    In your database for "image" the names you have entered should not have an extension such as .jpg. Your example should end with t05007
    ? you should use the correct file extension assuming you are not relying on apache's force-type etc , the database used is not relevant.


    ./products/belts/t05007.jpg should work. right?
    well no cos that gives "./images./products/belts/t05007.jpg" as the final string echo'ed to the browser.

    believe me , you can not go wrong with absolute URL's
    PHP Code:
    <a href="http://domain.com/images<?=img_path;?>" />
    but if your database entry actually has the leading './' then remove it either in the db or use e.g
    PHP Code:
    <a href="http://domain.com/images<?=substr($img_path,1);?>" />
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #10
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by firepages
    ? you should use the correct file extension assuming you are not relying on apache's force-type etc
    I only have two days worth of MySQL so I'm still sort of out in left field. I am working on a MySQL/PHP image gallery.

    When I entered into the database 1234.jpg the image would not show up, if I entered 1234 then it was OK. I assumed that the database was looking for 1234.jpg.jpg

    I will be reading up on apache to configure it properly.
    Leonard Whistler

  • #11
    Regular Coder
    Join Date
    Oct 2004
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This:
    PHP Code:
    <img src="./images/<?php echo($row['image']); ?>" alt="<?php echo($row['name']); ?> Product Image" border="1" />
    Produces:
    Code:
    <a onclick="javascript:ow(Flipflop Belt,)"><img src="Belts/./images/products/belts/t05007.jpg" alt="Flipflop Belt" /></a>
    The 'Belt' (which is the category name) is the error. However from the above PHP i don't understand what is causing the 'Belt' to even be there. Anyone?


  •  

    Posting Permissions

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