http://php.net/image
<?php
function resizeImage($image,$width=null,$height=null){
if(!$width and !$height) return false;
$info = getimagesize($image);
if(!$height) $height = $width/$info[0]*$info[1];
if(!$width) $width = $height/$info[1]*$info[0];
$new = newEmptyImage($width, $height);
$resource = imagecreatefromgif($image);
imagecopyresampled($new,$resource,0,0,0,0,$width,$height,$info[0],$info[1]);
return imagegif($new,$image);
}
function newEmptyImage($width,$height){
$new = imagecreatetruecolor($width,$height);
imagealphablending($new, false);
imagesavealpha($new, true);
$bg = imagecolorallocatealpha($new,0,0,0,127);
imagefill($new,0,0,$bg);
return $new;
}
?>
今、あなたは単に私のJavaScriptの作品を書いたresizeImage("example.gif",120);
これはjavascriptよりも優れたプログラミング言語を必要とします。 –
@SamuelLiew - PHPをタグとして追加することは、OPが要件をこれに限定していない場合、すべての回答がPHPソリューションになることを意味します。私はOPがプログラミング言語に言及していないと思うなら、あなたはPHPソリューションで答えるのは自由であるべきですが、PHPになるように質問を変更しないでください。 – Curt
@DanBizdadea JavaScriptはCanvasまたはSVGを使用して画像を操作することもできます。 –