Introducing Dynamic Templates

We have teamed up with a group of designers to create dynamic video templates for a range of different use cases.

Best of all - these are all free to use for use with the Shotstack API.

And if something is missing please let us know below and we’ll look to get it designed and added to the template repository.

A few examples

I’m probably missing something obvious, but I was wondering what an easier way to use the real estate template would be inside a PHP file. Right now I’m just looking at the JSON of the template and then translating it for use inside a PHP file like this:

//html assets
// HTML - top layer (track4)
$HtmlA = new HtmlAsset();
$HtmlA
->setType(‘html’)
->setHtml(‘

192 STOREY STREET

’)
->setCss(“p { font-family: “Manrope ExtraBold”; color: #f0c20c; font-size: 40px; text-align: left; padding-left: 10px; line-height: 78; }”)
//->setWidth(320)
//->setHeight(200)
->setPosition(‘left’);

			$HtmlClip1 = new Clip();
			$HtmlClip1
               ->setAsset($HtmlA)
               ->setStart(1.2)
               ->setLength(4.2)
               ->setPosition('left');

There must be an easier way??

Thanks!

Right now you would manually need to translate everything to the SDK from JSON. We are working on a way to deserialize a JSON string in to SDK objects which will do exactly what you want.

Another way might be to write some custom PHP and read the JSON directly from a file. You could decode it, make changes and then encode it again. You could then use Guzzle or Curl library to send the JSON directly to the API.

Also it might be handy to be across merge fields which let you easily find/replace strings inside the JSON using the API: Merging Data | Shotstack Documentation

1 Like