Last active
April 3, 2020 07:07
-
-
Save stefanzweifel/968e68785277013ac214 to your computer and use it in GitHub Desktop.
Screeenly API Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$payload = array( | |
'key' => 'YOUR-API-KEY', | |
'url' => 'https://www.youtube.com/' | |
'height' => 800, // Optional | |
'width' => 500 // Optional | |
); | |
$payload = json_encode($payload); | |
$ch = curl_init('http://screeenly.com/api/v1/fullsize'); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | |
'Content-Type: application/json', | |
'Content-Length: ' . strlen($payload)) | |
); | |
$result = curl_exec($ch); | |
var_dump($result); | |
$result = json_decode($result); | |
$path = $result->path; | |
?> | |
<hr> | |
<img src="<?php echo $path; ?>" alt="Screenshot"> |
Hi, i am having problems manipulating image output size. seems that there is a maximum set? is this correct. i need a thumbnail size of 265w x 201h but of the desktop version of website. any advice on implementation?
thank you
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With comments, so it's a bit easier to understand how it works: https://gist.github.com/AC10/c50a87e684cf93c24d86