나는 기능이이 funqction와 나는`당신이 그것을하지 존재하는 경우 내가 m getting image link and then chacking if file exists and I
m 파일을 만들 이해 내 서버이미지 servre
foreach($value[0] as $imagekey => $imageval) {
$imgname = $gancxadeba . '_' . $imagekey;
$saveaddr = dirname(dirname($_SERVER['PHP_SELF'])).'/www/classifieds_images/';
$as = '.JPG';
$originalname = $imgname . $as;
if(!file_exists($saveaddr.$originalname)) {
if (preg_match('/\.(jpg)$/', $imageval)) {
$getfile = imagecreatefromjpeg($imageval);
} elseif (preg_match('/\.(JPG)$/', $imageval)) {
$getfile = imagecreatefromjpeg($imageval);
} elseif (preg_match('/\.(png)$/', $imageval)) {
$getfile = imagecreatefrompng($imageval);
} else {
$getfile = imagecreatefromgif($imageval);
}
list($width, $height) = getimagesize($imageval);
$newWidth = 90;
$newHeight = 120;
$original = imagecreatetruecolor($width, $height);
imagecopyresampled($original, $getfile, 0, 0, 0, 0, $width, $height, $width, $height);
imagejpeg($original, "../www/classifieds_images/$originalname");
echo 'განცხადება: ' . $gancxadeba . ' ორიგინალი სურათი: ' . $imgname . ' created!' . PHP_EOL;
$thumbname = $imgname . '_THUMB' . $as;
if (!file_exists($saveaddr . $thumbname)) {
$thumb = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($thumb, $getfile, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
imagejpeg($thumb, "../www/classifieds_images/$thumbname");
echo 'განცხადება: ' . $gancxadeba . ' თამბი სურათი: ' . $imgname . ' created!' . PHP_EOL;
}
}
$image[$imagekey] = $imgname;
}
에서 일부 이미지를 만들려고. 내 서버가 느려집니다. 2GB RAM을 사용 중입니다. 서버 속도를 높이려면 어떻게해야합니까?
먼저 file_put_content()를 시도한 다음 엄지 손가락 을 만들었지 만 gd 라이브러리뿐만 아니라 작동하지 않습니다. 이렇게 빨리이 기능을 수행하도록 도와주세요.
속도가 느린 파일이 생성되지 않습니다. 그러나 이미지 라이브러리를 사용하여 가장 유명한 것을 시도해 보셨습니까? –