PHP SDK (Legacy) asset administration

Last updated: Nov-14-2022

While using Cloudinary, all your images, videos, and other raw files are uploaded to Cloudinary. You can use our Media Library web interface to browse through and manage your uploaded media assets and generated transformations. In addition, you can use methods from the Upload and Admin APIs, which offer methods for managing, organizing, and creating media assets.

  • Upload API methods can be used as needed.
  • Admin API methods are rate-limited.
    You can view the number of hourly Admin API requests allowed by your Cloudinary plan in the Account page of your Console Settings.

Upload API

In addition to the upload method, this API includes methods for:

Admin API

A secure API with methods for managing and organizing your media assets, including:

Upload API example - delete a single asset

The following PHP example uses the Upload API destroy method to delete the video with public ID sample:

Copy to clipboard
require "cloudinary.php";
require "uploader.php";
$api = new \Cloudinary\Uploader();
$result = $api->destroy('sample', 'resource_type' => 'video');

Sample output:

Copy to clipboard
{
  "result": "ok"
}

Tip
To delete multiple assets use the Admin API delete_resources method.

For more Upload API examples in PHP, select the PHP tab in the Upload API reference.

Admin API example - get details of a single asset

The following PHP example uses the Admin API resource method to return details of the image with public ID sample:

Copy to clipboard
require "cloudinary.php";
require "api.php";
$api = new \Cloudinary\Api();
$result = $api->resource("sample");

Sample output:

Copy to clipboard
{
  "asset_id": "d86882d7788f5d1d702cb63418f082a6",
  "public_id": "sample",
  "format": "jpg",
  "version": 1312461204,
  "resource_type": "image",
  "type": "upload",
  "created_at": "2017-08-04T12:33:24Z",
  "bytes": 120253,
  "width": 864,
  "height": 576,
  "url": "http://res.cloudinary.com/demo/image/upload/v1312461204/sample.jpg",
  "secure_url": "https://.../image/upload/v1312461204/sample.jpg",
  "next_cursor": "041a39fc10971b9eabd4993470f6bfaf",
  "derived": [
    {
      "transformation": "c_fill,w_100,h_100",
      "format": "jpg",
      "bytes": 7112,
      "id": "8267a869b62a93a59248f35d7f124c1f",
      "url": "http://.../demo/image/upload/c_fill,w_100,h_100/v1312461204/sample.jpg",
      "secure_url": "https://.../image/upload/c_fill,w_100,h_100/v1312461204/sample.jpg"
    },
    {
      "transformation": "w_230,h_168,c_fit",
      "format": "jpg",
      "bytes": 19173,
      "id": "383e22a57167445552a3cdc16f0a0c85",
      "url": "http://.../demo/image/upload/w_230,h_168,c_fit/v1312461204/sample.jpg",
      "secure_url": "https://.../image/upload/w_230,h_168,c_fit/v1312461204/sample.jpg"
    }
  ]
 }

For more Admin API examples in PHP, select the PHP tab in the Admin API reference.

✔️ Feedback sent!

Rate this page: