mysql field data type mediumblob. Insert image but not Show IMAGE

Discussion in 'PHP' started by xceedbd, Dec 21, 2009.

  1. #1
    For Insert i use this code: ITs works check database data insert.


    For Show image: its not works no error not show.

    i check other data show without image.


    Please help me
     
    xceedbd, Dec 21, 2009 IP
  2. astkboy2008

    astkboy2008 Peon

    Messages:
    211
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    my god
    i think the idea in not good
    if you saved img in db
    you must use the
    like that
    
    <?php
    $data = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl'
           . 'BMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDr'
           . 'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r'
           . '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';
    $data = base64_decode($data);
    
    $im = imagecreatefromstring($data);
    if ($im !== false) {
        header('Content-Type: image/png');
        imagepng($im);
    }
    else {
        echo 'An error occurred.';
    }
    ?> 
    
    PHP:
     
    astkboy2008, Dec 21, 2009 IP
  3. xceedbd

    xceedbd Well-Known Member

    Messages:
    640
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    128
    Digital Goods:
    1
    #3
    Hello astkboy2008,
    Thanks for help . but can u clear me .

    where call my database field.

     
    xceedbd, Dec 21, 2009 IP
  4. astkboy2008

    astkboy2008 Peon

    Messages:
    211
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i dont know how you stord the data in the mysql
    but i know you should use the imagecreatefromstring()
     
    astkboy2008, Dec 21, 2009 IP
  5. xceedbd

    xceedbd Well-Known Member

    Messages:
    640
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    128
    Digital Goods:
    1
    #5
    OH

    code here:
     
    xceedbd, Dec 21, 2009 IP
  6. xceedbd

    xceedbd Well-Known Member

    Messages:
    640
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    128
    Digital Goods:
    1
    #6
    mysql field data type mediumblob
     
    xceedbd, Dec 21, 2009 IP
  7. xceedbd

    xceedbd Well-Known Member

    Messages:
    640
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    128
    Digital Goods:
    1
    #7
    i want help yet.
     
    xceedbd, Dec 21, 2009 IP
  8. xceedbd

    xceedbd Well-Known Member

    Messages:
    640
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    128
    Digital Goods:
    1
    #8
    find out the problem. its ok now
     
    xceedbd, Apr 11, 2010 IP
  9. vosh

    vosh Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    mmm....interesting, thanks
     
    vosh, Apr 12, 2010 IP