Bitnami WAMP、Windows 10でgdイメージを出力するには? ファイルとして作成できますが、出力は機能しません。Bitnami WAMP、Windows 10でgdイメージを出力するには?
ファイルがないため、エラーが発生しています。http://localhost/type705b/public/index.php/test/img11
ホストの後のパラメータ(public/index.php/test/img11)は、コントローラアクションにアクセスするために使用されます。 実際のファイルは
たぶん私は.htaccess
を修正し、画像のサポートを有効にする必要が/type705b/src/Bundle/Resources/views/test/img/ImageOutputingError.php
Options -MultiViews
Options -Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /public/
IndexIgnore *
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{ENV:REQUEST_FILENAME} !-d
RewriteCond %{ENV:REQUEST_FILENAME} !-f
RewriteCond %{ENV:REQUEST_FILENAME} !-l
RewriteRule ^index.php?(.+)$ index.php?url=$1 [QSA,L]
、画像はChromeとOperaで表示されていない、Firefoxでエラーが発生し「画像http://localhost/type705b/public/index.php/test/img11を、それが誤りを含んでいるため表示できません」と、エクスプローラのクロスを持つ小さな正方形が表示されます。
インスペクタは、コードとして表示する(iはIMG ||、||」体エラーを作った)、このマークアップを示す:
背景画像は私のスクリプトで使用なし色を有する|| body style="margin: 0px; background: #0e0e0e;">
|| img style="-webkit-user-select: none;background-position: 0px 0px, 10px 10px;background-size: 20px 20px;background-image:linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%),linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);" src="http://localhost/type705b/public/index.php/test/img11">
</body>
。 #0000FF;。
ImageOutputingError.php
$width = 150;
$height = 150;
$img = imagecreate($width, $height);
//Create image background
//$white = ImageColorAllocate($img, 255, 255, 255);
//$black = ImageColorAllocate($img, 0, 0, 0);
//$red = ImageColorAllocate($img, 255, 0, 0);
$blue = imagecolorallocate($img, 0, 0, 255);
ImageFill($img,$width,$height,$blue);
header('Content-type: image/gif');
imagegif($img);
imagedestroy($img);
imagecolordeallocate($img, $blue);
ImageCreatingWorking.php
//This one works, but i want to output, versus file creation
$width = 150;
$height = 150;
$img = imagecreate($width, $height);
$blue = imagecolorallocate($img, 0, 0, 255);
ImageFill($img,$width,$height,$blue);
imagegif($img, __DIR__ .'/trial.gif');
imagedestroy($img);
imagecolordeallocate($img, $blue);
/* *ののphpinfo()
PHPバージョン5.6.30 < ...>
GDサポートが
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.7.0
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 9 compatible
PNG Support enabled
libPNG Version 1.5.26
WBMP Support enabled
XPM Support enabled
libXpm Version 30411
XBM Support enabled
WebP Support enabled
(2.1.0互換)同梱
GDのバージョンを有効に
*/
ありがとうございます。 'ImageOutputingError.php'をlocalhostディレクトリに置き、直接URL localhst/ImageOutputingError.phpを使います。これはうまくいきます。独自のフレームワークアクションに含める場合にのみ機能します。たぶんヘッダーが間違って送信されるか、どこかで画像が表示されないようにします。 –