- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我一直致力于加载 PNG 文件的图像处理功能。虽然它在我的本地服务器(Windows、PHP 5.3.6)和远程服务器(FreeBSD、PHP 5.3.6)上运行良好,但在使用 imagecreatefrompng 时,PHP 返回“500 内部服务器错误”。通常,我会查阅/var/log/php.log 中的日志 - 但当我尝试加载页面时,日志中没有添加任何内容。如果我注释掉包含 imagecreatefrompng 的行,脚本将加载 - 尽管由于缺少图像资源而将许多错误输出到日志中。
我试过添加:
ini_set('display_errors', 1);
error_reporting(E_ALL);
代码,没有区别。
phpinfo的输出显示GD已加载,gd_info的输出为:
array(12) {
["GD Version"]=>
string(27) "bundled (2.0.34 compatible)"
["FreeType Support"]=>
bool(true)
["FreeType Linkage"]=>
string(13) "with freetype"
["T1Lib Support"]=>
bool(true)
["GIF Read Support"]=>
bool(true)
["GIF Create Support"]=>
bool(true)
["JPEG Support"]=>
bool(true)
["PNG Support"]=>
bool(true)
["WBMP Support"]=>
bool(true)
["XPM Support"]=>
bool(true)
["XBM Support"]=>
bool(true)
["JIS-mapped Japanese Font Support"]=>
bool(false)
}
在这一点上,我完全迷路了。没有核对我的 php 安装并重试,我不知道该怎么做。我计划在端口更新后升级到 5.4,但考虑到我无法确定问题所在 - 我不知道这是否能解决问题。
这是相关代码的片段:
/* load image */
$imgname = '/images/'.$doctype.'_'.side($_GET['side']).".png";
$image_path = trim(shell_exec('pwd')).$imgname;
if(!file_exists($image_path)){
trigger_error('Image file not found!');
exit;
}
$im = imagecreatefrompng($image_path);
我已经尽力确保我使用的是图像的绝对路径,仔细检查图像是否存在 (file_exists()),如果不存在则报错。无论我做什么,只要 imagecreatefrompng 未被注释,我就会收到无声的 500 错误。
编辑:我添加了片段:
var_dump(is_readable($image_path));
var_dump(file_exists($image_path));
我的代码导致:
bool(true) bool(true)
所以看起来图像文件可以被 PHP 读取。我还验证了该图像是一个实际的 PNG 文件。还有其他想法吗?
最佳答案
你检查过文件权限了吗?
if(!file_exists($path) || !is_readable($path))....
有时它让我着迷。
而且,我不是那个,但是......你在那之前检查它是否真的是一个 png 文件??
关于PHP GD 静默失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9593326/
我对 JavaScript/jQuery 和 Web 开发有点陌生。我当前的项目是为网站建立一个小型聊天室。一切正常,但我有一个问题: 如何将数据从客户端传输到服务器并返回(例如通过 javascri
warn 4 与 print STDERR 4 有何不同? perl -e 'local *STDERR; warn 4' (输出仍然转到 STDERR ) perl -e 'local *STDER
所以在面对可怕的javax.faces.application.ViewExpiredException之后,我不得不在互联网上寻找合适的解决方案。幸运的是,这些解决方案随时可用,我继续采用了 Omn
我正在尝试使用 Spring Modules 项目中的声明性缓存。 它不起作用,即。似乎没有任何东西被缓存。 这是我的配置:
我正在实现以下教程:Speech To Text 我正在使用 AVAudioEngine 和 SFSpeechRecognizer 录制音频实现语音到文本。此处教程使用以下方法将语音引导至文本一个开始
我有一个文本(有多行),需要将其放入 wxPython TextCtrl 中。 问题是其中一些行包含无法打印的字符。 我的解决方案是使用 AppendText,并 try catch 有问题的行。 当
有没有办法直接从 Angular/客户端应用程序使用“用户名”和“密码”登录? 例如像这样的东西? Keycloak.init({username: 'guest', password: 'abc'}
我这样执行 GET 请求: http://www.smurf.com/path/?var=val 这显示在用户的 URL 中。我当然在几乎每个主要网站上都看到了这一点。 但我只是好奇是否有办法绕过它。
假设我有两个相互硬链接(hard link)的文件: -rw-rw-r-- 2 mparrott grp 5 Jul 28 09:38 bar -rw-rw-r-- 2 mparrott grp 5
我想在 android 4+ 中以编程方式(直接)添加日历事件。这可以在模拟器上测试吗?我没有安卓手机。一些示例代码将不胜感激。我阅读了 android 开发人员的日历提供程序,但我很困惑。如何将事件
我正在向我的工作簿添加一个新工作表 Application.ScreenUpdating = False SheetExists = False For Each WS In Worksheets
我正在 Excel 中的 VBA 中进行一些网页解析;我是 MSHTML 来下载和解析网页。但是,在某些站点上,会弹出一个对话框。它工作正常;但是,我想知道是否有办法禁用它或可能绕过它。感谢您的时间。
有没有办法使用谷歌的 firebase 发送一个无声的 APNS? 似乎如果应用程序在后台,它总是会向用户显示通知。 谢谢? 最佳答案 您可以使用 FCM 服务器 API 发送静默 APNS 消息 h
我有一个 Powershell 脚本来放松机器上的执行策略,本质上是运行: Set-ExecutionPolicy Unrestricted -Force 由于 ExecutionPolicy 在机器
我有一个 Powershell 脚本,用于将我们的生产数据库复制到我们的测试环境以及相关的清理事件。我想清理为用户输出到控制台的信息,但在清理从 Az.sql 命令中收到的错误消息时遇到了问题。 我的
这是我当前的 Facebook 应用程序登录流程(有关解释,请参阅 this answer)。 logout() 和 login() 是在用户注销或登录时呈现页面的虚拟函数。 window.fbAsy
我有一个 React Native 应用程序,我正在尝试将静默的 iOS 推送通知发送到 JavaScript 中的处理程序。 我看到的行为是 AppDelegate 中的 didReceiveRem
我正在使用数据通知来更新我的应用程序状态,它在 Android 上运行完美,但我无法在 IOS 上接收到任何数据消息,甚至没有触发 onMessage 监听器。 我正在使用这些: firebase_c
我知道较新的 GCC 版本引入了可能错误的字符串操作“stringop-truncation”的警告 这是我可以轻松触发此警告的示例代码: $ cat strncpy-warning.cxx #inc
标题基本上描述了它。 我检查过的事情: 验证了远程 Powershell session 中的用户名(以确保事情正在以我期望的权限执行) 检查了所描述文件的权限。预期用户拥有文件的完全控制权 删除了
我是一名优秀的程序员,十分优秀!