开发者

PHP images returning 500 internal server error?

开发者 https://www.devze.com 2023-02-07 09:41 出处:网络
I have some code that adds some headers to an image: Contents of title-background.png.php: <开发者_Python百科?php

I have some code that adds some headers to an image:

Contents of title-background.png.php:

<开发者_Python百科?php
$im = imagecreatefrompng("title-background.png");

header('Cache-Control: public');
header('Content-type: image/png');
header('Expires: 19 Febuary 2012 20:00:00 GMT');

imagepng($im);
imagedestroy($im);
?>

And that's working fine. But when I tried to do the same with another file,

Contents of button.png.php:

<?php
$im1 = imagecreatefrompng("button.png");

header('Cache-Control: public');
header('Content-type: image/png');
header('Expires: 19 Febuary 2012 20:00:00 GMT');

imagepng($im1);
imagedestroy($im1);
?>

The server returns with 500. I have no access to my logs.


I suspect that button.png doesn't exist, can't be read, or is somehow incompatible with imagecreatefrompng().


Wow, Sorry guys - cluttering up the stackoverflow server. Withing 1mins over my breakfast I worked it out...

the title-background.png.php was pointed to from a .css fie ON THE SAME SERVER :- however, the button.png.php was from a DIFFERENT SERVER!

I have now fixed it by putting the full paths, including http://'s and the such.

0

精彩评论

暂无评论...
验证码 换一张
取 消