From 807827bf41351c6a1e6fa43c22a63454e956b1dc Mon Sep 17 00:00:00 2001 From: GrabzIt Date: Mon, 22 Apr 2024 22:50:44 +0100 Subject: [PATCH] Added video scaling to PHP --- composer.json | 2 +- lib/GrabzItVideoOptions.php | 40 +++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 22d5877..0d5fa35 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "homepage": "https://grabz.it/", "description": "Use our API to allow your app to create images, DOCX documents, videos, rendered HTML and PDF's from URL's or raw HTML. Additionally GrabzIt allows you to convert online videos into animated GIF's or HTML tables into CSV's.", "license": "MIT", - "version":"3.5.3.1", + "version":"3.5.4", "autoload": { "psr-4": { "GrabzIt\\": "lib/" diff --git a/lib/GrabzItVideoOptions.php b/lib/GrabzItVideoOptions.php index ee142a3..0235ed7 100644 --- a/lib/GrabzItVideoOptions.php +++ b/lib/GrabzItVideoOptions.php @@ -6,6 +6,8 @@ class GrabzItVideoOptions extends GrabzItBaseOptions private $customWaterMarkId = null; private $browserWidth = null; private $browserHeight = null; + private $width = null; + private $height = null; private $start = null; private $duration = null; private $framesPerSecond = null; @@ -96,6 +98,38 @@ public function getBrowserHeight() return $this->browserHeight; } + /* + Set the width of the resulting video in pixels + */ + public function setWidth($value) + { + $this->width = $value; + } + + /* + Get the width of the resulting video in pixels + */ + public function getWidth() + { + return $this->width; + } + + /* + Set the height of the resulting video in pixels + */ + public function setHeight($value) + { + $this->height = $value; + } + + /* + Get the height of the resulting video in pixels + */ + public function getHeight() + { + return $this->height; + } + /* Set a custom watermark to add to the video. */ @@ -226,9 +260,9 @@ public function _getSignatureString($applicationSecret, $callBackURL, $url = nul "|".$this->nullToEmpty($this->browserHeight)."|".$this->nullToEmpty($this->browserWidth)."|".$this->nullToEmpty($this->getCustomId())."|". $this->nullToEmpty($this->customWaterMarkId)."|".$this->nullToEmpty($this->start)."|". $this->nullToEmpty(intval($this->requestAs))."|".$this->nullToEmpty($this->getCountry())."|".$this->nullToEmpty($this->getExportURL())."|". - $this->nullToEmpty($this->waitForElement)."|".$this->nullToEmpty($this->getEncryptionKey()."|". + $this->nullToEmpty($this->waitForElement)."|".$this->nullToEmpty($this->getEncryptionKey())."|". $this->nullToEmpty(intval($this->noAds))."|".$this->nullToEmpty($this->post)."|".$this->nullToEmpty($this->getProxy())."|".$this->nullToEmpty($this->address)."|".$this->nullToEmpty(intval($this->noCookieNotifications))."|". - $this->nullToEmpty($this->clickElement)."|".$this->nullToEmpty($this->framesPerSecond)."|".$this->nullToEmpty($this->duration)); + $this->nullToEmpty($this->clickElement)."|".$this->nullToEmpty($this->framesPerSecond)."|".$this->nullToEmpty($this->duration)."|".$this->nullToEmpty($this->width)."|".$this->nullToEmpty($this->height); } public function _getParameters($applicationKey, $sig, $callBackURL, $dataName, $dataValue) @@ -236,6 +270,8 @@ public function _getParameters($applicationKey, $sig, $callBackURL, $dataName, $ $params = $this->createParameters($applicationKey, $sig, $callBackURL, $dataName, $dataValue); $params['bwidth'] = $this->nullToEmpty($this->browserWidth); $params['bheight'] = $this->nullToEmpty($this->browserHeight); + $params['width'] = $this->nullToEmpty($this->width); + $params['height'] = $this->nullToEmpty($this->height); $params['duration'] = $this->nullToEmpty($this->duration); $params['waitfor'] = $this->nullToEmpty($this->waitForElement); $params['customwatermarkid'] = $this->nullToEmpty($this->customWaterMarkId);