Comments

1 comment

  • Avatar
    Raz Ziv

    Hi Radomir,

    Yes, of course, you can achieve all of the mentioned actions using our PHP SDK.

    First, you can upload the asset using the `\Cloudinary\Uploader::upload()` method which is described here.

    Then you can extract the image URL from the upload response array or generate it yourself using the cloudinary_url() helper function and use `file_put_contents()` PHP function to save the returned image from the URL on your machine. For example:

    $url = '<the_url_extracted_from_the_upload_response>';
    $file = '/path/to/image-file.jpg';
    file_put_contents($file, file_get_contents($url));

    Then eventually you can delete the image using the `\Cloudinary\Uploader::destroy()` method to delete the image from your cloud. If you also want to make sure that the CDN cache for the image is invalidated as well, you need to make sure that you pass `'invalidate' => true` in the array of parameters that you add to the request, as described here.

    Best,
    Raz

    0
    Comment actions Permalink

Please sign in to leave a comment.