how to read secure url from the response object after uploading in php
I tried the following, upload is successful and returns an object as response
$config = Configuration::instance();
$config->cloud->cloudName = '';
$config->cloud->apiKey = '';
$config->cloud->apiSecret = '';
$config->url->secure = true;
$cloudinary = new Cloudinary($config);
$resp = $cloudinary->uploadApi()->upload( './Broccoli.gif', ["use_filename" => TRUE, "unique_filename" => FALSE, "folder" => "mythumbs"] );
and I received the following response
Cloudinary\Api\ApiResponse Object ( [rateLimitResetAt] => [rateLimitAllowed] => 0 [rateLimitRemaining] => 0 [headers] => Array ( [Date] => Array ( [0] => Sat, 28 May 2022 18:58:47 GMT ) [Content-Type] => Array ( [0] => application/json; charset=utf-8 ) [Transfer-Encoding] => Array ( [0] => chunked ) [Connection] => Array ( [0] => keep-alive ) [Vary] => Array ( [0] => Accept-Encoding ) [Status] => Array ( [0] => 200 OK ) [Cache-Control] => Array ( [0] => max-age=0, private, must-revalidate ) [X-XSS-Protection] => Array ( [0] => 1; mode=block ) [X-Request-Id] => Array ( [0] => a57f3df3ad7ba508ac21009183adb527 ) [X-UA-Compatible] => Array ( [0] => IE=Edge,chrome=1 ) [ETag] => Array ( [0] => "38ba68cdf700d347e507b1f5e15176fe" ) [Server] => Array ( [0] => cloudinary ) ) [storage:ArrayObject:private] => Array ( [asset_id] => 68b431d7e07ffeca56af43062eb6da22 [public_id] => mythumbs/Broccoli [version] => 1653764327 [version_id] => ba3190f6dc801e856e8056ac0e2a8be8 [signature] => 50974060aa15a82b8fa0e5ee6c49809d82c46189 [width] => 600 [height] => 600 [format] => gif [resource_type] => image [created_at] => 2022-05-28T18:58:47Z [tags] => Array ( ) [pages] => 1 [bytes] => 13349 [type] => upload [etag] => fc64f57bcf6066b19f1b7d803298bc25 [placeholder] => [url] => http://res.cloudinary.com/cloudname/image/upload/v1653764327/mythumbs/Broccoli.gif [secure_url] => https://res.cloudinary.com/cloudname/image/upload/v1653764327/mythumbs/Broccoli.gif [folder] => mythumbs [original_filename] => Broccoli [api_key] => ) )
I want to read the secure url and store it in db. how to do that, I couldn't find any example in the documetation section.
0
-
Hi Nancy,
ApiResponse that returns in our PHP SDK is an extension of Arrayobject - thus every method that works on Arrayobject will work on the response. The method you're looking for is `OffsetGet` which returns values at the specified index.
You can read more about OffsetGet Here.
Kind regards,Tamara
0
Post is closed for comments.
Comments
1 comment