前提・実現したいこと
画像を上下中央に配置したいです
計算式がおかしいのか中央になりません
$x=600-$width/2;
$y=250-$height/2;
この計算式ではなりませんでした
詳しい方教えて下さい
該当のソースコード
<?php $filename = 'image URL'; header('Content-Type: image/jpg'); list($width, $height) = getimagesize($filename); $image_p = imagecreatetruecolor(600, 250); $image = imagecreatefromjpeg($filename); $x=600-$width/2; $y=250-$height/2; imagecopyresampled($image_p, $image, $x, $y, 0, 0, 600,250, 600,250); imagejpg($image_p, null, 100); ?>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。