Skip to content

Commit

Permalink
Added video scaling to PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabzIt committed Apr 22, 2024
1 parent 77b08f1 commit 807827b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
40 changes: 38 additions & 2 deletions lib/GrabzItVideoOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -226,16 +260,18 @@ 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)
{
$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);
Expand Down

0 comments on commit 807827b

Please sign in to comment.