Задайте вопросы о том, как захватывать или конвертировать веб-страницы или HTML into изображения, CSV, PDF или DOCX документы, а также о том, как конвертировать видео into анимированные GIF с использованием нашего API.
Привет всем
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");
эхо $индекс;
"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");
эхо $индекс;
Ты не звонишь Save correctly. It should be have the URL of your callback handler, not a image URL.
Цена на обработчик обратного вызова будет затем save файл.