アップロード画像ファイルに qualit=80 を追加したいのですが...成功しません:(
それは私のコードです:
<?php
// Set limit image size
$limitFileSize=300000;
// Set thumbnail-height to xxx in pixels
$imageheight=250;
if($peoplef_id=='0'){
$query = "SELECT * FROM peoplef WHERE emailzugang='$emailzugang1' ";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){$peoplef_id=$row['id'];};
}
if($peoplef_id!='0'){
uploadPic("pic1",$peoplef_id,$limitFileSize);
uploadPic("pic2",$peoplef_id,$limitFileSize);
uploadPic("pic3",$peoplef_id,$limitFileSize);
uploadPic("pic4",$peoplef_id,$limitFileSize);
uploadPic("pic5",$peoplef_id,$limitFileSize);
uploadPic("pic6",$peoplef_id,$limitFileSize);
uploadPic("pic7",$peoplef_id,$limitFileSize);
uploadPic("pic8",$peoplef_id,$limitFileSize);
}
function uploadPic($PicName,$itemsID,$limitFileSize)
{
//if($_FILES[$PicName]['size'] > 0 && $_FILES[$PicName]['size'] < $limitFileSize )
//{
if($_FILES[$PicName]['size'] > 0 )
{
$fileName = $_FILES[$PicName]['name'];
$tmpName = $_FILES[$PicName]['tmp_name'];
$fileSize = $_FILES[$PicName]['size'];
$fileType = $_FILES[$PicName]['type'];
$imgsize = GetImageSize($tmpName);
$widthWanted=$imgsize[0];
$heightWanted=$imgsize[1];
/*== check size 0=width, 1=height ==|| ($imgsize[1] > 200) */
if (($imgsize[0] > 650) )
{
$widthWanted=2000;
$heightWanted=ceil((1600/$imgsize[0])*$imgsize[1]);
}
echo $widthWanted;
echo "-----";
echo $heightWanted;
$array=array();
echo "<pre>";
$current_file=$tmpName;
$thumb_name="TempUploadImg/".$PicName.$itemsID.".jpg";
exec("convert ".$current_file." -resize $widthWantedx$heightWanted ".$thumb_name, $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
$fp = fopen($thumb_name, 'r');
$content = fread($fp, filesize($thumb_name));
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
$picnum=$PicName;
$query = "INSERT INTO uploadf (peoplef_id, picnum, name, size, type, content ) ".
"VALUES ('$itemsID', '$picnum', '$fileName', '$fileSize', '$fileType', '$content')";
//delete("test.jpg");
mysql_query($query) or die('Error, query failed');
echo "<br>Filee ". basename( $fileName). " uploaded<br><br>";
}
//else
//{
/// if($_FILES[$PicName]['size'] > 0){
// $fileName = $_FILES[$PicName]['name'];
// echo "<br><font color=red> File limit Size is $limitFileSize ; canot uploaded $fileName </font><br>";
// }
//}
}
?>