Results 1 to 4 of 4

Thread: PHP/MySQL Display Image Issue

  1. #1

    Default PHP/MySQL Display Image Issue

    I have a page that calls php script to display an image. The problem is that it only displays half the image. So you can see the top of tyhe image until about the middle and then the rest is blank. The image is there becuase it is the same size as the uploaded file but it is not coming back form the database correctly. I am using header("Content_type: $type"). If you need to see my code let me know.

  2. #2
    Join Date
    Feb 2006
    Location
    Waterford MI USA
    Posts
    34

    Default

    Maybe the image is corrupted or uploaded in the wrong mode???
    I have done that before, uploaded an image in ASCII instead of BINARY... I got mixed results... sometimes it was garbled, other times it was only half of a picture...
    Try reuploading your image to the server via FTP, make sure to upload in BINARY mode.

    HTH!
    God Bless!

    Bonnie
    Scottcrew Web Services
    eCommerce Specialists
    http://www.scottcrewwebservices.com

  3. #3
    Join Date
    Sep 2007
    Posts
    1

    Default Only showing half the image

    I know this is a very old post, but I thought I could help if someone esle runs across this problem. (like I did)

    For me, I was having this issue too, then realized I was storing the file in MySQL as a BLOB type when it should have been a LONGBLOB type. That was it!

    I hope this helps someone.

  4. #4
    Join Date
    Mar 2009
    Posts
    1

    Default displaying image problem php

    PLz Help
    i have some Images in DataBase in Blob field
    but images are displayed with a Cross (X) not the actual image

    MainPage.php//code
    <?php
    $con = mysql_connect("localhost","root","");
    if (!$con)
    die('Could not connect: ' . mysql_error());
    mysql_select_db("db1", $con);
    $image = mysql_query("SELECT * FROM userimagetable");
    while($imageResult = mysql_fetch_array($image) ){
    ?>
    <img src="ViewImage.php?id=<?=$imageResult['id']?>" alt="Picture" /></td></tr>
    <?php
    }

    and the other file displaying image code is

    ViewImage.php
    <?php
    $id = $_GET['id'];
    $image = mysql_query("SELECT * FROM userimagetable WHERE Id='".$id."'");
    $imageResult = mysql_fetch_array($image);
    header("Content-type: image/jpg");
    echo $imageResult['UserImage'];
    ?>
    plz help me

Posting Permissions

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