Hiya,
I've been working on this problem for some time and also did some research in here but I haven't been able to find a satisfying answer.
What I need is having stored (and later retrieved) a picture in MySQL after it has been resized with GD Library.
The problem I have is that I just can't figure out how to store it in mysql.
Here's some of the coding:
// Assigning $src as the picture
$src = ImageCreateFromJPEG("$picture");
$org_h = imagesy($src );
$org_w = imagesx($src );
// Working out resizing ratios
if($org_h > $org_w ) {
$cfg[height] = 150;
$cfg[width] = floor($cfg[height] $org_w / $org_h );
$cfg[dstX] = 90 - ($cfg[width] 0.5);
$cfg[dstY] = 15;
} else {
$cfg[width] = 150;
$cfg[height] = floor($cfg[width] $org_h / $org_w );
$cfg[dstX] = 15;
$cfg[dstY] = 90 - ($cfg[height] 0.5);
}
// Creating resized image
$img = ImageCreate( $cfg[width] , $cfg[height] );
ImageCopyResized($img, $src, 0, 0, 0, 0, $cfg[width], $cfg[height], $org_w, $org_h );
// Storing image on the Server
$path_temp = $path_temp.".jpg";
ImageJPEG($img, $path_temp, 100 );
// Following commented line is an example from the MySQL manual
// UPDATE table_name SET blob_column=LOAD_FILE("/tmp/picture") WHERE id=1;
$update ="UPDATE members SET picture=LOAD_FILE('$path_temp') WHERE vulgo='$vulgo'";
mysql_query($update) or die("File Upload Error - Please inform $my_email of this file upload error.");
It does not produce any error but when I got to the database, there's no information in the picture field. Anyone can help me out on this or even post some alternate code that is working?
Stephan