PHP imagejpeg()问题

编程入门 行业动态 更新时间:2024-10-23 06:31:23
本文介绍了PHP imagejpeg()问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个可以在我的小型共享主机上使用的图像上传脚本,但是当我切换到Virt Ded时,它立即停止了工作.经过一番研究,我确定罪魁祸首是PHP函数imagejpeg()-这是脚本中的最后一部分代码.

I had an image upload script that worked on my little shared hosting, but just as I switched to Virt Ded, it immediately stopped working. After some research I determined the culprit to be the PHP function imagejpeg() - which was the last bit of code in the script.

它允许我将null指定为文件路径(在这种情况下,它将打印到屏幕上),但是不允许我输入任何文件路径而不返回false.

It allows me to specify null as the filepath (in which case it prints it to the screen), but does not allow me to enter ANY filepath without return false.

有人知道发生了什么事吗?

Anybody know what is going on?

推荐答案

首先,我将了解PHP安装中是否包含imagejpeg()所需的所有libgd内容.

First I would see if the PHP install contains all the libgd stuff you need for imagejpeg().

您可以像这样检查:

$extensions = get_loaded_extensions(); if( !in_array( 'gd', $extensions ) ) { die "libgd is not loaded"; }

如果这样做很好,您可以执行以下操作:

If that's good to go you can do something like:

$gd = gd_info(); while( list( $k, $v ) = each( $gd ) ) { echo "$k: $v"; }

请确保您列出了一些jpeg内容,如果没有,则需要安装一些依赖库.

Make sure you see some jpeg stuff listed, if there is none you need some dependent libraries installed.

更多推荐

PHP imagejpeg()问题

本文发布于:2023-11-01 02:21:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547972.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:PHP   imagejpeg

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!