Closed razza-guhl closed 6 years ago
Hi, I'm not sure. But what is your use-case? Why you can't use url or local file?
I need to edit some images on the fly, pin them and throw the image away.
Local file method required the file physically exists on storage. But thats not necessary, all data are already in RAM and could be bypass directly.
Maybe PHP tmpfile() could be used in this case?
I see. Actually, I don't want to add functionality to bot for such rare use-case. Bot is built to emulate site behavior and there is no way to create a pin from image stored in memory. I can suggest you to create a temporary file, flush image data to it, create a pin from this local file, then remove it:
$tempFile = tempnam(__DIR__, 'temp_image');
file_put_contents($tempFile, $imageData);
$bot->pins->create($tempFile, $boardId, $description);
unlink($tempFile);
What do you think?
I understand, no problem. I'm going to use a temp file. Thanks for your suggestion!
Hi,
Is it possible to use an base64 encoded image for creating a pin? Currently URL and local file is supported.
$pinInfo = $bot->pins->create('http://exmaple.com/image.jpg', $boardId, 'Pin description');
Thank you