Hi,

How can I edit my code (shown at the bottom) to resize an image having the following in my database:

binary data of the image,
filename,
filesize,
filetype.

Below is the image production script in an image tag:

<?php
require_once("all_functions.php");
session_start();
if (!($conn = db_connect()))
    return false;
$valid_user = $HTTP_SESSION_VARS["valid_user"]; 
global $dbprefix;
$result = mysql_query( "select photoBinary, filetype
                          from ".$dbprefix.""."pictures
                          where pictureId =" . $_GET['id'])
  or die("Couldn't get image");

$photoBinary = @mysql_result($result,0,"photoBinary");
$filetype = @mysql_result($result,0,"filetype");

Header("Content-type: $filetype");
echo "$photoBinary";
?>

Many thanks in advance!

    Don't bother with GD. Maybe in another version or two they won't suck so backly...

    In the meantime, use ImageMagick (http://www.imagemagick.org) and use it with the backtick operation ("`");

    Best of luck. I know that running IM in a shell is a bad idea performance wise, which is why I cache the results 24 hours before sending them out to the browser!

    -Ben

      Write a Reply...