I've tried this:
$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
function RandChars( $passwordLength ) {
$passwordChars = '0123456789'
.'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
.'abcdefghijklmnopqrstuvwxyz';
$password = "";
for ($index = 1; $index <= $passwordLength; $index++) {
// pick random number
$randomNumber = rand(1,strlen($passwordChars));
$password .= substr($passwordChars,$randomNumber-1,1);
}
return $password;
}
// Database connection variables
$dbQuery = "SELECT blobType, blobData ";
$dbQuery .= "FROM $user_name ";
$dbQuery .= "WHERE blobFileName = '$filename'";
$result = mysql_query($dbQuery) or message_die(GENERAL_ERROR, "Couldn't get file list. ".mysql_error());
$data = @mysql_result($result, 0, "blobData");
$type = @mysql_result($result, 0, "blobType");
$exten = substr($filename, -3);
if ($exten != "jpg" AND $exten != "gif" AND $exten != "png" AND $exten != "bmp") {
$exten = substr($filename, -4);
}
$randname = RandChars('6');
$imagename = './~tmp/'.$randname.".".$exten;
$handle = fopen($imagename, 'w+');
fwrite($handle, $data);
fclose($handle);
exec('mogrify -size 120x120 '.$imagename.' -resize 120x120 +profile "*"');
$resizedImage = fopen($imagename, "r");
$resizedImage = fread($resizedImage, filesize($imagename));
unlink($imagename);
header("Content-type: $type");
echo $resizedImage;
Whats wrong with it?? It does absolutely nothing lol, it loads the image from mysql perfectly, makes a files perfectly, but the MOGRIFY does not work (i've also tried the usr/bin/mogrify)..so it just outputs the image as it would normally without thumbnailing it...