0

I would like to create a script which will be create a bigger or smaller image (all images in my script should be 170 x 200 px - if picture is bigger, script will create a smaller picture. If picture is smaller, script will create a bigger image).

I have these code:

require_once 'phpThumb-master/phpThumb.php';

try
{
     $thumb = PhpThumbFactory::create('http://page.com/image.jpg');
}
catch (Exception $e)
{
     // handle error here however you'd like
}

$thumb->adaptiveResize(175, 175);
$thumb->show();

But I get this:

phpThumb() v1.7.14-201602170915 http://phpthumb.sourceforge.net

ERROR: missing hash

Where is a problem?

fusion3k
  • 11,568
  • 4
  • 25
  • 47
NewbieUser
  • 191
  • 2
  • 10
  • This is not a strictly php issue, but it is related with 3rd part class. I have added [tag:phptumb] tag. Maybe someone can help you. Otherwise, you have to refer to _phptumb_ documentation. – fusion3k Feb 20 '16 at 16:35
  • See [this question](http://stackoverflow.com/questions/7053432/phpthumb-invalid-hash) and “Usage” chapter in [this official doc](http://phpthumb.sourceforge.net/demo/docs/phpthumb.readme.txt) – fusion3k Feb 20 '16 at 16:37
  • I tried everything solutions from this topic and everything doesn't work for me... – NewbieUser Feb 20 '16 at 17:26

1 Answers1

0

If $PHPTHUMB_CONFIG['high_security_enabled'] is set to true in phpThumb.config.php, you need hash.

Set it to false or try something like this:

echo '<img src="'.htmlspecialchars(phpThumbURL('src=/images/test.jpg&w=100', 'path/to/your/phpThumb.php')).'">';
erno666
  • 192
  • 1
  • 1
  • 10