Hi All,
I'm encountering an odd situation.
I'm uploading images to my site,.. playing with using ImageMagick.. So far...that works like a charm.
Now.. the second step is..saving the images to the MySQL database.
Well.. if you glance at the code below.. you will see the the
first image being processed fine.. and then preparing it for the database,.. then comes the second image.
Identical processing.
I have about 6 images like that.. in each record.
Running the code works fine.. No complaints from the database.
Now comes the weired stuff.
I can only extract the first image.
The rest of the images are getting currupted (on the load to the database. On the server they are created just fine and are viewable via the web - the newly processed images).
So the question is.. why is that happening? How do I get the images to load correctly and clean into the database. The first image ALWAYS loads fine!
///// AAAAAAAA - Image - In More Pictures - White Background
$cmd="${root}/home/soft/bin/run_from_nochroot composite -gravity center -size 500x500 -geometry 500x500 +profile \'*\' -sharpen 0x1 'temp12/ORIGINAL.$date.$rand.$type' -size 500x500 xc:white temp12/Image.$another1.jpg";
exec("$cmd 2>&1");
$filename = "temp12/Image.$another1.jpg";
$fd = fopen ($filename, "rb");
$Image = addslashes(fread ($fd, filesize ($filename)));
fclose ($fd);
////// BBBBBBBBBBBB - ImageMediumGalleryBlack - Black Background
$cmd="${root}/home/soft/bin/run_from_nochroot composite -gravity center -size 96x96 -geometry 96x96 +profile \'*\' -sharpen 0x1.5 'temp12/ORIGINAL.$date.$rand.$type' -size 96x96 xc:black temp12/GalleryBlack.$another1.jpg";
exec("$cmd 2>&1");
$filename = "temp12/GalleryBlack.$another1.jpg";
$fd = fopen ($filename, "rb");
$GalleryBlack = addslashes(fread ($fd, filesize ($filename)));
fclose ($fd);
.... <same stuff goes more here>...
$sql = "INSERT INTO Images ( Id,
Views,
Format,
Image,
ImageMediumGalleryBlack,
ImageMediumGalleryWhite,
ImageMediumShowRoomGrey,
ImageMediumShowRoomWhite,
ImageMediumShowRoomGreenHilite,
ImageMediumCarDetail)
VALUES ($newid,
0,
'$File_type',
'$Image',
'$ImageMediumGalleryBlack',
'$ImageMediumGalleryWhite',
'$ImageMediumShowRoomGrey',
'$ImageMediumShowRoomWhite',
'$ImageMediumShowRoomGreen',
'$ImageMediumCarDetail')";
Thanks for your help
-Alon.
js@wsco.com