Submit Your Article Forum Rules

Results 1 to 2 of 2

Thread: image retrieval from database not working?

  1. #1
    Junior Member
    Join Date
    Jan 2004
    Posts
    25

    image retrieval from database not working?

    my prob.:iam getting image from database
    but not able to convert that image(resize taht is).
    Warning: getimagesize: Unable to open 'ÿØÿá›Exif' for reading. in c:\apache\htdocs\upload\sho1.php on line 19

    my php code:
    / database connection
    $conn = mysql_connect("localhost") OR DIE (mysql_error());
    @mysql_select_db ("beebaho", $conn) OR DIE (mysql_error());
    $sql = "SELECT * FROM images WHERE Id=4";
    $result = mysql_query ($sql, $conn);
    if (mysql_num_rows ($result)>0) {
    $row = @mysql_fetch_array ($result);
    $image_type = $row["image_type"];
    global $maxH,$maxW,$image,$imgInfo,$imgwidth,$imgheight;
    $image = $row["pic"];

    // echo $image;

    $imgInfo= getimagesize($image);

    $imgwidth = $imgInfo[0];
    $imgheight = $imgInfo[1];
    $maxW=200;
    $maxH=300;
    if ($imgwidth > $maxW) {
    $ration = $maxW/$imgwidth;
    $newwidth = round($imgwidth*$ration);
    $newheight = round($imgheight*$ration);
    if ($newheight > $maxH) {
    $ration = $maxH/$newheight;
    $newwidth = round($newwidth*$ration);
    $newheight = round($newheight*$ration);
    return array("image" => $image, "width" => $newwidth, "height" => $newheight);
    echo $image;
    } else {
    return array("image" => $image, "width" => $newwidth, "height" => $newheight);
    echo $image;
    }
    } else if ($imgheight > $maxH) {
    $ration = $maxH/$imgheight;
    $newwidth = round($imgwidth*$ration);
    $newheight = round($imgheight*$ration);
    if ($newwidth > $maxW) {
    $ration = $maxW/$newwidth;
    $newwidth = round($newwidth*$ration);
    $newheight = round($newheight*$ration);
    return array("image" => $image, "width" => $newwidth, "height" => $newheight);
    echo $image;
    } else {
    return array("image" => $image, "width" => $newwidth, "height" => $newheight);
    echo $image;
    }
    } else {
    return array("image" => $image, "width" => $newwidth, "height" => $newheight);
    echo $image;
    }



    // Header ("Content-type: $image_type");
    echo $image;
    }
    ?>


    if comment "$imgInfo= getimagesize($image);"
    and "echo $image;"
    then it works but image is very large
    The impossible doesnot Exist!

  2. #2
    Senior Member Deep13's Avatar
    Join Date
    Dec 2003
    Posts
    302
    I hope the image path you have specified in the database match with the actually path of the image..

    and 2nd thing...

    in that warning..why it is not displaying the image ext? are u stroing image name without ext or something?

    Deep

Similar Threads

  1. Demo Some Content Based Image Retrieval Software
    By WPW_Feedbot in forum Search Engine Optimization Forum
    Replies: 0
    Last Post: 05-18-2005, 11:30 PM
  2. Anyone have working Image Ads in AdWords?
    By fourfivetwofour in forum Google AdWords/Google AdSense
    Replies: 7
    Last Post: 05-18-2005, 06:01 PM
  3. All About Content Based Image Retrieval
    By WPW_Feedbot in forum Search Engine Optimization Forum
    Replies: 0
    Last Post: 05-05-2005, 12:00 PM
  4. CSS background image - not working
    By MikeSzyszka in forum Graphics & Design Discussion Forum
    Replies: 2
    Last Post: 04-12-2005, 07:47 AM
  5. Image Search and Retrieval Research: Recognizing Visual Pat
    By WPW_Feedbot in forum Search Engine Optimization Forum
    Replies: 0
    Last Post: 03-24-2005, 01:30 PM

Posting Permissions

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