0

I am using a PHP Thumbnail Generating script that I have used without issue many times in the past. I am currently using it without issue on the very same domain that I am now having problems. The script is processing to a point. It is generating physical thumbnail images and saving them into the preset cache directory but it is not returning resized images to the browser. The image src is in the following format:

<img src="thumbnail.php?file=sample/02.jpg&w=100&h=70&el=0&gd=0" />

I have confirmed that the image exists and can be displayed in a browser itself. Also, the PHP script loads ok as I have tested it by adding an 'echo' to confirm. I have installed this script in multiple locations on the server and the result is the same. I have even tried other versions of PHP Thumbnail Generators and none of them produce resized images in the browsers.

I have checked that GD is active on my server:

GD Support          enabled
GD Version          bundled (2.1.0 compatible)
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.4.2
GIF Read Support    enabled
GIF Create Support  enabled
JPEG Support        enabled
libJPEG Version     6b
PNG Support         enabled
libPNG Version      1.2.44
WBMP Support        enabled
XBM Support         enabled

PHP is version 5.3.29

Imagemagick is available and path confirmed as '/usr/bin/convert/'.

Here you see the result:

http://demos.mitey.co.nz/image_processor/index.php

All that appears is broken image placeholders instead of the dynamically generated thumbnails. All relevant permissions have be set to 0777 or 0755, tried both. This really isn't a difficult script to use and I have numerous times in the past but I am unable to debug whatever is causing it to fail in this instance.

Anybody have any ideas as to what could be stopping the image source from correctly processing the PHP contained within it? I have tried so many different things that I can no longer focus on the issue and come up with anything else to try.

4

2 回答 2

1

已解决:我试图将图像从另一个子域加载到脚本中。我使用的缩略图脚本声称允许使用从另一个域加载图像,但是当涉及到无法通过协议http工作的 PHP 函数“file_exists”时,它会失败。http我使用“str_replace”删除了图像路径的“http://”部分,并将其替换为文件系统路径,即/home/siteroot/,一切正常。当与缩略图生成脚本在同一个域中使用图像时,脚本很高兴保留完整的“http://”路径。没有有用的错误消息可以指出这一点。

于 2015-10-02T02:30:32.933 回答
0

从网站下载最新的 PHPthumb 生成 thumb 参见文档

不要忘记根据需要更改变量。

$thumbUrl = "somefolder/new.jpg";
$resizeWidth = "70"; // in pixels
$resizeHeight = "70"; // in pixels

$imageThumb = $directoryPath. "/phpThumb/phpThumb.php?src=" . $thumb1 . "&amp;w=".$resizeWidth."&amp;h=".$resizeHeight."&amp;iar=1&amp;hash=90e9d46c4d138a72574c52e31fbef0dc";

echo '<img src="'.$imageThumb.'" alt="filename.jpg" />';
于 2015-10-01T06:56:27.443 回答