Closed Thread
Page 7 of 22 FirstFirst ... 5678917 ... LastLast
Results 61 to 70 of 214

Thread: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

  1. #61
    Jaan Guest

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Well.. you can't have

    Code:
     <table border="1">
        <tr>
            <td><? echo $id; ?></td>
            <td><img src="showimage.php?id=<?=$id;?>" width="144" height="165" /></td>
            <td><? echo $imagename; ?></td>
            <td><? echo $description;?></td>
        </tr>
    this thingy in your file because of this:

    Code:
    header('Content-type: image/jpeg'); 
    this thingy tells to browser that your file is a jpeg image file.. and have you seen a picture with html in it ?
    I believe no.. so just remove this html..and you will be fine

  2. CODECALL Circuit advertisement

     
  3. #62
    jonasd is offline Newbie
    Join Date
    May 2009
    Posts
    1
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Thank you very much, this is a very good tutorial

  4. #63
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Wouldnt it be better - instead of doing the "addslash" and just echoing it out directly to just do some type of encryption/decryption? The one I always used was "base64_encode" and "base64_decode". Either way nice tutorial I really enjoyed it.

  5. #64
    kingnige is offline Newbie
    Join Date
    May 2009
    Posts
    1
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    cheers for the tutorial

    code works perfectly in Firefox

    however when using Safari (and working on an apple mac) instead of showing the image it simply downloads the php file that should be displaying the image.

    is there some simple code I can add to solve this, or is this something that Safari does and I need new/different code to ensure compatibility with all browsers?

  6. #65
    ssSuave is offline Newbie
    Join Date
    Jan 2009
    Posts
    12
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Hi I have followed all the steps and I understand the concept behind uploading and displaying an image, however the image still does not display for me.

    I believe the problem is with the rights of the file or something. The reason why I think so is because i have tried uploading an image to the "uploads" folder with ftp and i can easily display it however if i upload the same exact image with the upload form and then i try to view it I get the following message "403 Forbidden".

    If it makes any difference I am using a hosted site.

    Any idea why when i upload an image with the upload form it becomes forbidden in the folder?

  7. #66
    Jaan Guest

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Well.. Here we upload a picture into a database and then you are displaying it.. it must work correctly.. but if you upload your picture to a folder and you have this error then I believe there are problems with folder viewing permissions.. do you have a .htaccess file there or something ?

  8. #67
    ssSuave is offline Newbie
    Join Date
    Jan 2009
    Posts
    12
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    So I have the following setup:

    mywebsite.com contains a folder "uploads"
    mywebsite.com contains all of my php pages

    I host my website, so in order to make sure that my folder(uploads) had read and write access rights i have created it on my computer and then sent it with ftp to my host. So I assume the folder still has the correct permission rights set up.

    I am not sure what .httaccess you are referring to. But the "uploads" folder contains nothing but the images i try uploading.

    It is weird that it works fine if i ftp and image (i am then able to view it). But if i use the uploads form it does get uploaded but i cant view it and get that "forbidden" message.

    Thank you for help!

  9. #68
    Jaan Guest

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Well.. check the folder's permissions.. is it 0777 or just 777 or something else ?

  10. #69
    ssSuave is offline Newbie
    Join Date
    Jan 2009
    Posts
    12
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    I called up the website i am hosting with and was told that
    the folder has correct permission settings but the image files do not have correct permission settings. It seems that the permission settings of the image file change when it is uploaded through the file upload form.

    I was told that i need to change permission setting in my actual code. any idea how to do so?

  11. #70
    Jaan Guest

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    you can use this function PHP: chmod - Manual

    like this:

    Code:
    chmod("path/to/your/file.jpg"0777); 

Closed Thread
Page 7 of 22 FirstFirst ... 5678917 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Similar Threads

  1. Replies: 3
    Last Post: 02-07-2011, 11:29 AM
  2. Tutorial: Storing Images in MySQL with PHP
    By Jordan in forum PHP Tutorials
    Replies: 47
    Last Post: 01-04-2011, 08:37 PM
  3. Beginner Storing images in XML file - Part II - Displaying image
    By Jaan in forum PHP Tutorials
    Replies: 6
    Last Post: 01-04-2011, 08:35 PM
  4. display images sequentially using PHP and MySQL
    By jhanjon in forum PHP Development
    Replies: 2
    Last Post: 10-08-2009, 12:11 PM
  5. Replies: 2
    Last Post: 07-16-2009, 12:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

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