php gd function で画像を反転しようとしていますimageflip()
。GDをインストールしました。WindowsでWAMPとcodeigniterを使用しています。(そして、wampにimagemagickを実装するのはちょっと難しいので、私はしたくないです)。imageflip() は、私が見ているように動作するはずです。PHP バージョン 5.4.16 を使用しています。
多分私は何かが足りない...
からphpinfo()
:
gd
GD Support enabled
GD Version bundled (2.1.0 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.4.10
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 8
PNG Support enabled
libPNG Version 1.2.50
WBMP Support enabled
XPM Support enabled
libXpm Version 30411
XBM Support enabled
Directive Local Value Master Value
gd.jpeg_ignore_ warning 0 0
私はこのコードを持っています:
foreach($products_settings as &$ps) {
$filename = $_SERVER['DOCUMENT_ROOT'] . $ps['product_file'];
$source_image = imagecreatefromjpeg($filename);
//Put source image-resource into array
$ps['source_image'] = $source_image;
}
そしてそれは動作します..
私が使用するimagerotate()
と、それも機能します...
foreach($products_settings as &$ps) {
$filename = $_SERVER['DOCUMENT_ROOT'] . $ps['product_file'];
$source_image = imagecreatefromjpeg($filename);
//rotate image
$angle = $ps['product_angle'];
if (intval($angle) <> 0) {
$source_image = imagerotate($source_image, 360-$angle, imageColorAllocateAlpha($source_image, 255, 255, 255, 127));
}
//Put source image-resource into array
$ps['source_image'] = $source_image;
}
...しかし、imageflip を使用する場合 ( http://php.net/manual/en/function.imageflip.php )
foreach($products_settings as &$ps) {
$filename = $_SERVER['DOCUMENT_ROOT'] . $ps['product_file'];
$source_image = imagecreatefromjpeg($filename);
imageflip($source_image, IMG_FLIP_BOTH); //code execution stops here
//Put source image-resource into array
$ps['source_image'] = $source_image;
}
その後、imageflip()
コードが停止します(ログメッセージをログに記録しない行の後に追加すると)。理由がわかりません。その理由は何でしょうか?codeigniter/php/apache のエラー ログに何も表示されません。マニュアルには、失敗すると関数が false を返すと書かれていますが、他の gd 関数 (など)imagerotate
と同じ画像に対して他の gd 関数を使用しているため、画像が正しいことはわかっています。imageColorAllocateAlpha
私もこれを試しました:
try {
imageflip($source_image, IMG_FLIP_BOTH);
}
catch (Exception $e) {
log_message('DEBUG', 'img err' . $e->__toString());
}
しかし、何も記録されません...
これをデバッグする方法は?