Tools to Capture and Convert the Web
GrabzIt's Online Community

save vs saveTo

Hi there

I was trying to get grabzit to speed up the capture process and found that the "save"/asynchronous method should be faster after doing some reading on your site. The problem is when I try to use it, it doesn't seem to work. When I use the "saveTo" method, that works fine. So I'm not sure what I'm missing? I've added the example of both methods below and was wondering if you seen anything that might be wrong. I'm using ajax to pass the information to the php script.

 

"saveTo" example below....(working)

session_start();
include("php/lib/GrabzItClient.php");

$grabzIt = new \GrabzIt\GrabzItClient("OGEzYWE1Mjg2NDQwNGM5ODlhZTYxNDVlMjJiMjIzMTk=", "P1odIFI/Oj80Hj8/PxFcPz8/C1A/CAkqP08EPz9TPz8=");
$pages = $_POST['pages'];
$coverW = $_POST['coverW'];
$coverH = $_POST['coverH'];
$index = $_POST['index'];

$coverW2 = round($coverW*0.1);
$coverH2 = round($coverH*0.1);

$getsize = $_POST['getsize'];
$getemail = $_SESSION['Capture1'];
$gettitle = $_POST['gettitle'];
$getdatecreated = $_POST['getdatecreated'];
$gettimecreated = $_POST['gettimecreated'];
$getbooktheme = $_POST['getbooktheme'];
$newTheme = $_POST['newTheme'];




$options = new \GrabzIt\GrabzItImageOptions();
$options->setCountry("US");
$options->setBrowserWidth($coverW);
$options->setBrowserHeight($coverH);
$options->setWidth($coverW);
$options->setHeight($coverH);
$options->setFormat("jpg");
$options->setTargetElement(".viewcover");


$grabzIt->HTMLToImage($pages, $options);
$grabzIt->SaveTo( "tempUpload/spread".$index.".jpg");

echo $index;

 

 

 

"save" example below...(not working)

session_start();
include("php/lib/GrabzItClient.php");

$grabzIt = new \GrabzIt\GrabzItClient("OGEzYWE1Mjg2NDQwNGM5ODlhZTYxNDVlMjJiMjIzMTk=", "P1odIFI/Oj80Hj8/PxFcPz8/C1A/CAkqP08EPz9TPz8=");
$pages = $_POST['pages'];
$coverW = $_POST['coverW'];
$coverH = $_POST['coverH'];
$index = $_POST['index'];

$coverW2 = round($coverW*0.1);
$coverH2 = round($coverH*0.1);

$getsize = $_POST['getsize'];
$getemail = $_SESSION['Capture1'];
$gettitle = $_POST['gettitle'];
$getdatecreated = $_POST['getdatecreated'];
$gettimecreated = $_POST['gettimecreated'];
$getbooktheme = $_POST['getbooktheme'];
$newTheme = $_POST['newTheme'];




$options = new \GrabzIt\GrabzItImageOptions();
$options->setCountry("US");
$options->setBrowserWidth($coverW);
$options->setBrowserHeight($coverH);
$options->setWidth($coverW);
$options->setHeight($coverH);
$options->setFormat("jpg");
$options->setTargetElement(".viewcover");


$grabzIt->HTMLToImage($pages, $options);
$grabzIt->Save( "https://www.capturehearts.com/Capturehearts/photobookapp/tempUpload/spread".$index.".jpg");

echo $index;

Asked by Deverre Lovence on the 22nd of May 2020

You are not calling Save correctly. It should be have the URL of your callback handler, not a image URL.

The callback handler will then save the file.

Answered by GrabzIt Support on the 22nd of May 2020