+ Reply to Thread
Page 8 of 16
FirstFirst ... 6 7 8 9 10 ... LastLast
Results 71 to 80 of 159

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

  1. #71
    Newbie poeticparadox is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    2

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

    Jaan,

    I have been working through your tutorial but I have missed something as the output is still coming out in code rather then the image. Example: studiosgroup.co.uk/don/viewimg.php?imgid=001. Thanks for you help

  2. #72
    Moderator Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan's Avatar
    Join Date
    Dec 2006
    Location
    Estonia
    Age
    18
    Posts
    2,069
    Blog Entries
    9

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

    Hmm well your ID can't be like that.. ?imgid=001 it must be and it is ?imgid=1 because this ID is automatically generated..
    Get A Cheap Top Level Domain, COM and NET domains only for $7.95 - Get Yours Now!
    Trill Hosting - Cheap SSL, Cheap Web Hosting, Register Cheap Domains, Cheap Blog Hosting
    www.trillhosting.com | support@trillhosting.com
    Hosting Plans | Write To Us | Support | Client Area | About Us

    CodeCall Blog | CodeCall Wiki

  3. #73
    Newbie poeticparadox is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    2

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

    This is the code that I am using to insert the image into the database:
    Code:
    <?php
    // Create MySQL login values and 
    // set them to your login information.

      
    include "includes/functions.php";
      include 
    "includes/config.php";
      require_once 
    "includes/db.php";
     

    // Make the connect to MySQL or die
    // and display an error.
     
      
    $d = new dbC();
      
    $d->connect($db_host$db_user$db_pass$db);

    if (!
    $d) {
        die(
    'Could not connect: ' mysql_error());
    }

    // Select your database
    //mysql_select_db ($database); 

    // Make sure the user actually 
    // selected and uploaded a file
    if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { 

          
    // Temporary file name stored on the server
          
    $tmpName  $_FILES['image']['tmp_name'];  
           
          
    // Read the file 
          
    $fp      fopen($tmpName'r');
          
    $data fread($fpfilesize($tmpName));
          
    $data addslashes($data);
          
    fclose($fp);
          

          
    // Create the query and insert
          // into our database.
          
    $query "INSERT INTO tbl_images ";
          
    $query .= "(image, Memberno) VALUES ('$data','$_POST[memberno]')";
          
    $results mysql_query($query);
          
          
    // Print results
          
    print "Thank you, your file has been uploaded.";
          echo 
    $empid;
          
    }else{
       print 
    "No image selected/uploaded";
    }

    // Close our MySQL Link
    $d->close();
    ?>
    As you can see I am calling an empid so that I can preform a one to many relationship with tbl_Emp and tbl_images (for example) I am then passing the empid to the veiwimg.php to call up all the images for that emp. Make sence?
    Last edited by WingedPanther; 06-10-2009 at 01:28 PM. Reason: add code tags (the PHP sheet)

  4. #74
    Newbie kipper is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    1

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

    Hi, thanks a lot for your tutorial!

    May i ask if i can display a picture of students on excursion with comments from teachers, parents and fellow students, with all pictures and comments stored in a database. All the information is on the same page, something like a report.

    Thanks a lot in advance,
    Lee

  5. #75
    Code Warrior BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch's Avatar
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Age
    20
    Posts
    2,223
    Blog Entries
    8

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

    Quote Originally Posted by kipper View Post
    Hi, thanks a lot for your tutorial!

    May i ask if i can display a picture of students on excursion with comments from teachers, parents and fellow students, with all pictures and comments stored in a database. All the information is on the same page, something like a report.

    Thanks a lot in advance,
    Lee
    Its very possible. You can add a few more rows to the database to make this happen. If you want you could always hire me to do this for you. Email me for a quote.

  6. #76
    Newbie shamoco is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    1

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

    good code

  7. #77
    Newbie phpuser is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    1

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

    Hi,

    I have been following the forum. I tried display image. It worked. Thanks!
    I have question on that. How do we set the image size to display?

  8. #78
    Moderator Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan's Avatar
    Join Date
    Dec 2006
    Location
    Estonia
    Age
    18
    Posts
    2,069
    Blog Entries
    9

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

    well.. this script displays you the full image.. if you use other GD functions then you can resize this picture if you want..
    Get A Cheap Top Level Domain, COM and NET domains only for $7.95 - Get Yours Now!
    Trill Hosting - Cheap SSL, Cheap Web Hosting, Register Cheap Domains, Cheap Blog Hosting
    www.trillhosting.com | support@trillhosting.com
    Hosting Plans | Write To Us | Support | Client Area | About Us

    CodeCall Blog | CodeCall Wiki

  9. #79
    Jan
    Jan is offline
    Newbie Jan is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    7

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

    Hi,

    Apparently many people get this to work but after days of trying all different kinds of scripts I still can seem to get a picture showing on my page.
    I have copied your tutorial exactly but the best so far was when I got a pop-up asking me if I wanted to download the picture.
    How can I actually get this picture in a web page, i.e. how do I call it?
    Thanks, I'd appreciate any help..

  10. #80
    Moderator Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan's Avatar
    Join Date
    Dec 2006
    Location
    Estonia
    Age
    18
    Posts
    2,069
    Blog Entries
    9

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

    well.. you display it like this

    HTML Code:
    <img src="image.php?id=1" />
    Get A Cheap Top Level Domain, COM and NET domains only for $7.95 - Get Yours Now!
    Trill Hosting - Cheap SSL, Cheap Web Hosting, Register Cheap Domains, Cheap Blog Hosting
    www.trillhosting.com | support@trillhosting.com
    Hosting Plans | Write To Us | Support | Client Area | About Us

    CodeCall Blog | CodeCall Wiki

+ Reply to Thread
Page 8 of 16
FirstFirst ... 6 7 8 9 10 ... LastLast

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. Tutorial: Storing Images in MySQL with PHP
    By Jordan in forum PHP Tutorials
    Replies: 43
    Last Post: 01-16-2010, 10:35 AM
  2. Tutorial: PHP to MySQL
    By Jordan in forum PHP Tutorials
    Replies: 20
    Last Post: 08-28-2009, 04:22 AM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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