图片不显示在我的网站 [英] Images not showing on my site
问题描述
我不喜欢问这种问题。但图像的arent显示在我的Web服务器上一样,他们是我的本地系统上。
I hate to ask this kind of question. But the images arent showing on my web server like they were on my local system.
PHP信息 http://www.classifiedtestbed.com/test.php
图像丢失的例子: http://www.classifiedtestbed.com/advertisements/2
我的脚本是正确的,但我想这可能一个Apache或PHP的问题,请看看我的phpinfo(),并告诉我,如果你看到任何错误。
My script is correct but I am thinking this could a apache or php problem please look at my phpinfo() and tell me if you see anything wrong.
图像应该从我的TMP目录进行处理并转移到我的上传目录但从未发生过......我得到不是错误的php_errors并检查HTTD / error_log中
The images should be processing from my tmp dir and moving to my uploads dir but that never happens...I get not errors in php_errors and have checked httd/error_log
任何建议将是超级AP preciated,谢谢!
Any suggestions would be super appreciated, thank you!
public function createTN($image) {
# Load Zebra Image Library
require_once public_path().'/uploads/Zebra_Image.php';
$destinationPath = public_path().'/uploads/thumbnails/';
$tn = new Zebra_Image();
$tn->source_path = $image->getRealPath();
$tn->target_path = $destinationPath.$this->name.'.jpg';
$tn->jpeg_quality = 60;
$tn->preserve_aspect_ratio = true;
$tn->enlarge_smaller_images = true;
$tn->resize(100, 100, ZEBRA_IMAGE_CROP_CENTER);
}
的 PS:文件方式已更改为777已经的
<一个href=\"http://stackoverflow.com/questions/28912684/php-files-are-not-moving-from-tmp?noredirect=1#comment46083907_28912684\">PHP文件不会从/ tmp目录
public function createTN($image) {
# Load Zebra Image Library
require_once public_path().'/uploads/Zebra_Image.php';
$destinationPath = public_path().'/uploads/thumbnails/';
$tn = new Zebra_Image();
$tn->source_path = $image->getRealPath();
$tn->target_path = $destinationPath.$this->name.'.jpg';
$tn->jpeg_quality = 60;
$tn->preserve_aspect_ratio = true;
$tn->enlarge_smaller_images = true;
if (!$tn->resize(100, 100, ZEBRA_IMAGE_CROP_CENTER)) echo 'Error: ' . $tn->error;
echo 'Is file: ' . is_file($tn->source_path);
exit;
/*$tn->resize(100, 100, ZEBRA_IMAGE_CROP_CENTER);*/
}
输出:错误:7是文件:1
推荐答案
当出头失败了,你可以简单地调试事情一步一步,看看他们是否产生预期的结果。所以你的情况,这是一个方法 $ TN-&GT;调整大小(100,100,ZEBRA_IMAGE_CROP_CENTER);
这是为了调整图像并保存
When somethings fails down, you can simply debug things step by step to see if they produce expected result. So in your case, that was a method $tn->resize(100, 100, ZEBRA_IMAGE_CROP_CENTER);
which is meant to resize an image and save it.
从斑马的源$ C $ C,我们有:
From zebra's source code we have:
* @return boolean Returns TRUE on success or FALSE on error.
*
* If FALSE is returned, check the {@link error} property to see what went
* wrong
*/
public function resize($width = 0, $height = 0, $method = ZEBRA_IMAGE_CROP_CENTER, $background_color = '#FFFFFF')
所以东北角,发现出了什么毛病,你可以简单地测试它是这样的:
So obliviously, to find out what went wrong, you could simply test it like this:
if ( ! $tm->resize(..) ){
switch($tm->error){
// handle it somehow here
}
}
至于描述错误codeS,有一个官方页面
http://php.net/manual/en/book.image.php
CentOS7
-
百胜安装GD GD-DEVEL PHP-GD
- 重新启动Apache
这篇关于图片不显示在我的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!