SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2012
    Posts
    117
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Create image DB / php integration

    Hi!

    Im trying to make an integration with php and sql.
    I have a static webpage (html), with many hyperlinked image thumbs.
    I need each thumb to show in a new page with a description associated with the image, and the same image (bigger).
    I believe this isn't very hard, but for me is impossible to achieve without help building the database and all the php script needed..

  2. #2
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    There are a few steps involved, and a few decisions to make.

    1) Uploading the base image.

    http://php.net/manual/en/features.fi...ost-method.php

    2) Creating a thumbnail. Here you will want to keep both the original and the new thumbnail.

    http://www.9lessons.info/2009/03/upl...-with-php.html

    3) Saving to db. You have two choices here: move the images to a new folder and save the paths in the db or save the raw binary data. I can't say which is better for you.

    3a) Saving the path.

    *let me know which storage system you will be using, as well as which php wrappers, and one of us can assist you in the actual SQL code.

    3b) Saving the bytes.

    PHP Code:
    $data file_get_contents('path/to/image.jpg'); 
    $data base64_encode($data); 

  3. #3
    SitePoint Zealot
    Join Date
    Nov 2012
    Posts
    117
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot of!


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
  •