PHP Classes

Fatal error: Call to undefined function getimagesizefromstring()

Recommend this page to a friend!

      PHP Ultimate Web Page Capture  >  PHP Ultimate Web Page Capture package blog  >  PHP Screenshot Script...  >  All threads  >  Fatal error: Call to undefined...  >  (Un) Subscribe thread alerts  
Subject:Fatal error: Call to undefined...
Summary:Fatal error: Call to undefined function getimagesizefromstring()
Messages:3
Author:bill
Date:2016-08-06 02:28:07
 

  1. Fatal error: Call to undefined...   Reply   Report abuse  
Picture of bill bill - 2016-08-06 02:28:07

Greetings,

When I run example.php, this works great.

//display html image tag for captured webpage
$screenShot->displayImage();

If I run example.php with

$screenShot->capturePage();
$screenShot->downloadCapture('test.png');

The following error appears:
Fatal error: Call to undefined function getimagesizefromstring() in /home/rydscom/public_html/php/screenshot.class.php on line 105

Any guidance to fix the error would be gratefully received.

And thank you for the script.

Bill

  2. Re: Fatal error: Call to undefined...   Reply   Report abuse  
Picture of Dave Smith Dave Smith - 2016-08-06 05:14:52 - In reply to message 1 from bill
You need PHP version 5.4 or greater.

There is a work-around for older versions as long as your settings allow_url_fopen...

In the screenshot.class.php you will need to replace the line...

$this->imageInfo = getimagesizefromstring($this->capture);

with...

if(!function_exists('getimagesizefromstring')){
$uri = 'data://application/octet-stream;base64,'.base64_encode($this->capture);
$this->imageInfo = getimagesize($uri);
}else{
$this->imageInfo = getimagesizefromstring($this->capture);
}

I haven't tested this, however it should work in theory.

Dave

  3. Re: Fatal error: Call to undefined...   Reply   Report abuse  
Picture of bill bill - 2016-08-06 05:17:34 - In reply to message 2 from Dave Smith
Thank you very much Dave