幅が 500px を超えないように画像のサイズを変更したい。アスペクト比は同じでなければなりません。画像 (960x960) に変化が見られません。
これは私のコードです:
public static function resizeImage($imagename) {
        list($width, $height) = getimagesize($imagename);
        if($width < 500)
            return $imagename;
        $ratio = $width / $height;
        $new_width = 500;
        $new_height = $new_width / $ratio;
        $image_p = imagecreatetruecolor($new_width, $new_height);
        $image = imagecreatefromjpeg($imagename);
        imagecopyresampled ($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
        return $imagename;
    }
これは imagecopyresampled の入力です
Resource id #25|Resource id #27|0|0|0|0|500|500|960|960|