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.

StefanNch
  • 2,569
  • 24
  • 31
Mitey
  • 19
  • 3

2 Answers2

1

SOLVED: I was trying to load images into the script from another sub-domain. The Thumbnail script I was using claims to allow loading images from another domain using http however it thens fails when it comes to the PHP function 'file_exists' which does not work via the http protocol. I removed the 'http://' part of the image path using 'str_replace' and replaced it with the file system path, i.e. /home/siteroot/' and all works as expected. When used with images on the same domain as the thumbnail generating script the script is happy for the full 'http://' path to remain. There was no useful error messages to point this out.

Mitey
  • 19
  • 3
  • The way I do it is declaring two constants as in: `SITE_ROOT` (i.e. '/home/siteroot/') - the full path location to my sources, and `SITE_URL` (i.e. 'http://demos.mitey.co.nz/') - the full url of my site. So, given this test case, when i need to use an image in my code, i declare `$filename = SITE_ROOT . 'path/to/images/' . $image;` and I return `SITE_URL . 'path/to/images/'. $image;` – StefanNch Oct 02 '15 at 08:26
0

Download the latest PHPthumb from website For generate thumb see documentation

don't forget to Change variable as per your need.

$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" />';
Noman
  • 4,088
  • 1
  • 21
  • 36
  • Uploaded the latest version and ran check, results at [link](http://demos.mitey.co.nz/phpThumb/demo/phpThumb.demo.check.php) – Mitey Oct 01 '15 at 23:57
  • Still not working though, see here [link](http://demos.mitey.co.nz/phpThumb/demo/phpThumb.demo.demo.php) – Mitey Oct 01 '15 at 23:58
  • @Mitey you need to contact hosting provider to install [See phpthumb's ImageMagick](http://phpthumb.sourceforge.net/demo/demo/phpThumb.demo.check.php) See your [configuration link](http://demos.mitey.co.nz/phpThumb/demo/phpThumb.demo.check.php) – Noman Oct 04 '15 at 05:32