Example #1
0
 echo "<div class='public_id'>" . $photo["public_id"] . "</div>";
 echo cl_image_tag($photo["public_id"], array_merge($thumbs_params, array("crop" => "fill")));
 ?>
         </a>
       
       <div class="less_info">
         <a href="#" class="toggle_info">More transformations...</a>
       </div>
       
       <div class="more_info">
         <a href="#" class="toggle_info">Hide transformations...</a>
         <table class="thumbnails">
           <?php 
 $thumbs = array(array("crop" => "fill", "radius" => 10), array("crop" => "scale"), array("crop" => "fit", "format" => "png"), array("crop" => "thumb", "gravity" => "face"), array("override" => true, "format" => "png", "angle" => 20, "transformation" => array("crop" => "fill", "gravity" => "north", "width" => 150, "height" => 150, "effect" => "sepia")));
 foreach ($thumbs as $params) {
     $merged_params = array_merge(\Cloudinary\Cloudinary::optionConsume($params, "override") ? array() : $thumbs_params, $params);
     echo "<td>";
     echo "<div class='thumbnail_holder'>";
     echo "<a target='_blank' href='" . cloudinary_url($photo["public_id"], $merged_params) . "'>" . cl_image_tag($photo["public_id"], $merged_params) . "</a>";
     echo "</div>";
     echo "<br/>";
     \PhotoAlbum\array_to_table($merged_params);
     echo "</td>";
 }
 ?>
           
         </table>
         
         <div class="note">             	
         	Take a look at our documentation of <a href="http://cloudinary.com/documentation/image_transformations" target="_blank">Image Transformations</a> for a full list of supported transformations.
         </div>	
<?php

require 'main.php';
# You can add here your custom verification code
# Check for a valid Cloudinary response
$api_secret = \Cloudinary\Cloudinary::configGet("api_secret");
if (!$api_secret) {
    throw new \InvalidArgumentException("Must supply api_secret");
}
$existing_signature = \Cloudinary\Cloudinary::optionConsume($_POST, "signature");
$to_sign = array('public_id' => $_POST['public_id'], 'version' => $_POST['version']);
$calculated_signature = \Cloudinary\Cloudinary::apiSignRequest($to_sign, $api_secret);
if ($existing_signature == $calculated_signature) {
    # Create a model record using the data received (best practice is to save locally
    # only data needed for reaching the image on Cloudinary - public_id and version;
    # and fields that might be needed for your application (e.g.,), width, height)
    $photo = \PhotoAlbum\create_photo_model($_POST);
} else {
    error_log("Received signature verficiation failed (" . $existing_signature . " != " . $calculated_signature . "). data: " . \PhotoAlbum\ret_var_dump($_POST));
}