我正在使用此代码上传和调整图片大小。 (现在,我只使用cropImage函数,因为我只需要拇指在这个部分)
使用此代码,我得到以下错误: 警告:imagesx()要求参数1为资源,字符串在第67行的/home/fayszakk/domain.hu/cms/uj-video.php中给出
警告:imagesy()要求参数1为资源,字符串在第67行的/home/fayszakk/domain.hu/cms/uj-video.php中给出
警告:imagecopy()要求参数1为资源,字符串在第67行的/home/fayszakk/domain.hu/cms/uj-video.php中给出
if($_FILES['termek_file']['size'] != 0 )
{
$ThumbSquareSize = $hir_thumb_size;
$BigImageMaxSize = $hir_big_size;
$ThumbPrefix = "th-";
$DestinationDirectory = '../images/youtube/';
$Quality = $imgQuality;
$stamp = imagecreatefrompng('../images/assets/play.png');
$marge_right = 10;
$marge_bottom = 10;
$sx = imagesx($stamp);
$sy = imagesy($stamp);
if(!isset($_FILES['termek_file']) || !is_uploaded_file($_FILES['termek_file']['tmp_name']))
{
$error[] = "Elképzelhető, hogy nem választott ki fényképet.";
}
$RandomNumber = rand(0, 99999999);
$ImageName = str_replace(' ','-',strtolower($_FILES['termek_file']['name']));
$ImageSize = $_FILES['termek_file']['size'];
$TempSrc = $_FILES['termek_file']['tmp_name'];
$ImageType = $_FILES['termek_file']['type'];
switch(strtolower($ImageType))
{
case 'image/png':
$CreatedImage = imagecreatefrompng($_FILES['termek_file']['tmp_name']);
break;
case 'image/gif':
$CreatedImage = imagecreatefromgif($_FILES['termek_file']['tmp_name']);
break;
case 'image/jpeg':
case 'image/pjpeg':
$CreatedImage = imagecreatefromjpeg($_FILES['termek_file']['tmp_name']);
break;
default:
$error[] = "Nem támogatott fájlformátum.";
}
list($CurWidth,$CurHeight)=getimagesize($TempSrc);
$ImageExt = substr($ImageName, strrpos($ImageName, '.'));
$ImageExt = str_replace('.','',$ImageExt);
$ImageName = preg_replace("/\\.[^.\\s]{3,4}$/", "", $ImageName);
$NewImageName = $ImageName.'-'.$RandomNumber.'.'.$ImageExt;
$thumb_DestRandImageName = $DestinationDirectory.$ThumbPrefix.$NewImageName;
$DestRandImageName = $DestinationDirectory.$NewImageName;
/*if(!resizeImage($CurWidth,$CurHeight,$BigImageMaxSize,$DestRandImageName,$CreatedImage,$Quality,$ImageType))
{
$error[] = "A fénykép átméretezése nem sikerült.";
}*/
imagecopy($thumb_DestRandImageName, $stamp, imagesx($thumb_DestRandImageName) - $sx - $marge_right, imagesy($thumb_DestRandImageName) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
if(!cropImage($CurWidth,$CurHeight,$ThumbSquareSize,$thumb_DestRandImageName,$CreatedImage,$Quality,$ImageType))
{
$error[] = "Nem sikerült a bélyegkép készítése.";
}
}
else
{
$error[] = "Nem választott ki fényképet.";
}
有人可以帮助我,我怎样才能将这个水印添加到上传的图片中?