public function show_image_from_cloudinary($image_name) { $cloud_name = 'hnyiprajv'; return cl_image_tag($image_name, array("cloud_name" => $cloud_name)); }
</div> <!-- Page Content --> <div class="container"> <div id="links"> <?php $api = new \Cloudinary\Api(); $result = $api->resources(array("max_results" => "500", "type" => "upload", "prefix" => "concert/")); foreach ($result["resources"] as $photo) { ?> <a href="<?php echo $photo["url"]; ?> " title="photo"> <?php echo cl_image_tag($photo["public_id"] . ".jpg", array("crop" => "scale", "width" => 0.04)); echo "\n"; ?> </a> <?php } ?> </div> <!-- Footer --> <footer> <div class="row"> <div class="col-lg-12"> <p>Copyright © Dalton House 2016</p> </div> <!-- /.col-lg-12 --> </div>
function cl_video_thumbnail_tag($source, $options = array()) { return cl_image_tag($source, array_merge(default_poster_options(), $options)); }
public function getImage() { try { return cl_image_tag($this->cloudinary_id, $this->image_options); } catch (\Exception $ex) { return; } }
function show_image($img, $options = array(), $caption = "") { $options["format"] = $img["format"]; $transformation_url = cloudinary_url($img["public_id"], $options); echo "<div class='item'>"; echo "<div class='caption'>" . $caption . "</div>"; echo "<a href='" . $img["url"] . "' target='_blank'>" . cl_image_tag($img["public_id"], $options) . "</a>"; echo "<div class='public_id'>" . $img["public_id"] . "</div>"; echo "<div class='link'><a target='_blank' href='" . $transformation_url . "'>" . $transformation_url . "</a></div>"; echo "</div>"; }
function show_image($img, $options = array(), $caption = '') { $options['format'] = $img['format']; $transformation_url = cloudinary_url($img['public_id'], $options); echo '<div class="item">'; echo '<div class="caption">' . $caption . '</div>'; echo '<a href="' . $img['url'] . '" target="_blank">' . cl_image_tag($img['public_id'], $options) . '</a>'; echo '<div class="public_id">' . $img['public_id'] . '</div>'; echo '<div class="link"><a target="_blank" href="' . $transformation_url . '">' . $transformation_url . '</a></div>'; echo '</div>'; }
public function uploadImage(Request $request) { $data = null; if (Request::isMethod('post')) { $validator = Validator::make(Input::all(), AdminTool::$uploadImageRules); if ($validator->passes()) { $file = \Request::file('yourfile'); //the files are stored in storage/app/*files* $output = Storage::put('yourfile.png', file_get_contents($file)); $cloudinary = ImageManagement::uploader($file); echo cl_image_tag($cloudinary['url'], array("alt" => "Sample Image")); echo "<hr />"; dd($cloudinary); if ($cloudinary) { return Redirect::to('admin/playground')->with('data', $cloudinary)->with('message', 'The following errors occurred')->withErrors('Your image has uploaded by using Cloudinary.'); } else { return Redirect::to('admin/playground')->with('message', 'The following errors occurred')->withErrors('Something went wrong with your upload. Please try again.'); } } else { return Redirect::to('admin/playground')->with('message', 'The following errors occurred')->withErrors($validator)->withInput(); } } return view('admin/testupload', compact($data)); }
public function getAssetTag(AssetFileModel $asset, $options) { $publicId = $this->getAssetHandle($asset); $this->includeJs(); return cl_image_tag($publicId, $options); }
public function imageTag($data, array $options = array()) { $image = $data == null ? NULL : implode('.', $data); return cl_image_tag($image, $options); }
</h1> <div class="row"> <?php foreach ($images as $image) { ?> <div class="col-xs-12 col-sm-6 col-md-3" id="<?php echo $image->id; ?> "> <div class="thumbnail"> <a href="<?php echo link_to('images', 'show') . "/" . $image->id; ?> "> <?php echo cl_image_tag($image->filename, array('width' => 200, 'height' => 200, 'crop' => 'fill')); ?> </a> <?php if (!$image->is_liked()) { ?> <a class="link-thumbs-up" href="<?php echo link_to('images', 'like') . "/" . $image->id; ?> "><i title="Like this image" class="thumbnail-thumbs-up fa fa-thumbs-o-up fa-2x"></i></a> <?php } else { ?> <a class="link-thumbs-down" href="<?php echo link_to('images', 'unlike') . "/" . $image->id; ?>
/** * Get the cloudinary image tag. * * @param string $id Image ID. * @param array $options options for the image. * @return string */ public function getImageTag($id, $options = array()) { return cl_image_tag($id, $options); }
function twitter_name_profile_image_tag($profile, $options = array()) { $options["type"] = "twitter_name"; return cl_image_tag($profile, $options); }
</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::option_consume($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> </div> </div> <?php
<?php echo $prev_media_list; ?> <?php foreach ($media_next as $next_media) { ?> <li class="col-md-4"> <a href="<?php echo URL::to('media') . '/' . $next_media->slug; ?> "> <div class="imgLiquidFill imgLiquid <?php if ($next_media->id == $media->id) { ?> active <?php } ?> " style="width:95px; height:95px;"> <?php echo cl_image_tag(Constant::FOLDER_CLOUDINARY . '/' . $next_media->pic_url, array('alt' => '...')); ?> </div> </a> </li> <?php } ?> </ul>
$files = $_FILES["files"]; $files = is_array($files) ? $files : array($files); $files_data = array(); foreach ($files["tmp_name"] as $index => $value) { array_push($files_data, create_photo($value, $files["name"][$index])); } ?> <html> <head> <link href="style.css" media="all" rel="stylesheet"/> <title>Upload succeeded!</title> </head> <body> <h1>Your photo has been uploaded sucessfully!</h1> <h2>Upload details:</h2> <?php foreach ($files_data as $file_data) { \PhotoAlbum\array_to_table($file_data); } ?> <br/> <?php echo cl_image_tag($file_data['public_id'], array_merge($thumbs_params, array("crop" => "fill"))); ?> <a href="list.php" class="back_link">Back to list...</a> </body> </html>
</table> </td> </tr> @endforeach </table> <tr> <td> <h5 style="font-weight: bold">About the Host, {{ $property->owner_name }}</h5> <table style="text-align: center; width: 100%"> <tr> <td style="width: 120px; text-align: left"><?php echo cl_image_tag($property->owner_pic->cloudinary_public_id, array("width" => 80, "height" => 80, "crop" => "fill", "radius" => 20)); ?> </td> <td style="text-align: left;"> @if($owner->location) <p>{{$owner->location}}</p> @endif <p>Joined {{ date('F d, Y', strtotime($owner->created_at)) }}</p> <p> <a href="mailto:{{ $owner->email }}" class="btn btn-info" role="button">Contact {{ $owner->first_name }}</a> </p> </td> <td style="text-align: right"> @if($owner->number_of_reviews == 0) <p>{{$owner->first_name}} has never been reviewed. </p>
<h3 align="center"> Family Album </h3> @if (count($images)) @foreach ($images as $image) <ul id="gallery"> <li> <a href="/image/{{ $image->id }}"> <?php echo cl_image_tag($image->big_name, array("cloud_name" => "hnyiprajv", "height" => 100, "class" => "img-rounded")); ?> {{--They all show up when I do this: --}} {{--<img src="http://res.cloudinary.com/hnyiprajv/image/upload/{{ $image->big_name }}" height = "100" class="img-rounded">--}} <p> {{ $image->caption }} @if ($image->year) ({{ $image->year}}) @endif </a></p> </li> </ul> @endforeach @endif
public static function upload($args) { $image = $args['image']; $folder = $args['folder']; $filename = $args['filename']; $type = $args['type']; if ($folder == 'images') { $month_year = date('FY') . '/'; } else { $month_year = ''; } $upload_folder = Constant::FOLDER_CLOUDINARY . '/' . $month_year; $arrayAllMedia = Media::all(); if (@getimagesize($image)) { if ($type == 'upload') { $filename = str_replace(" ", "-", $image->getClientOriginalName()); // if the file exists give it a unique name foreach ($arrayAllMedia as $media) { if ($month_year . $filename == $media->pic_url) { $filename = uniqid() . '-' . $filename; } } // Store in cloudinary \Cloudinary\Uploader::upload($_FILES['pic_url']['tmp_name'], array("public_id" => $upload_folder . '/' . pathinfo($filename, PATHINFO_FILENAME))); // $uploadSuccess = $image->move($upload_folder, $filename); if (strpos($filename, '.gif') > 0) { $new_filename = str_replace('.gif', '-animation.gif', $filename); // copy($upload_folder . $filename, $upload_folder . $new_filename); \Cloudinary\Uploader::upload($_FILES['pic_url']['tmp_name'], array("public_id" => $upload_folder . '/' . pathinfo($new_filename, PATHINFO_FILENAME))); } } elseif ($type = 'url') { // $file = file_get_contents($image); if (strpos($image, '.gif') > 0) { $extension = '-animation.gif'; } else { $extension = '.jpg'; } $filename = str_replace(" ", "-", $filename . $extension); // if the file exists give it a unique name foreach ($arrayAllMedia as $media) { if ($month_year . $filename == $media->pic_url) { $filename = uniqid() . '-' . $filename . $extension; } } if (strpos($image, '.gif') > 0) { // Store in cloudinary \Cloudinary\Uploader::upload($image, array("public_id" => $upload_folder . '/' . pathinfo($filename, PATHINFO_FILENAME))); $filename = str_replace('-animation.gif', '.gif', $filename); } \Cloudinary\Uploader::upload($image, array("public_id" => $upload_folder . '/' . pathinfo($filename, PATHINFO_FILENAME))); } $settings = Setting::first(); if ($settings->enable_watermark && $folder == 'images') { // Setting watermark + resize cl_image_tag($upload_folder . '/' . $filename, array("overlay" => Config::get('site.uploads_dir') . '/settings/' . $settings->watermark_image, "x" => $settings->watermark_offset_x, "y" => $settings->watermark_offset_y)); } else { // Setting watermark + resize cl_image_tag($upload_folder . '/' . $filename, array("width" => 200, "height" => 200)); } return $month_year . $filename; } else { return false; } }
<a href="<?php echo URL::to('media') . '/' . $item->slug; ?> " alt="<?php echo $item->title; ?> "> <!--<img class="single-media" alt="<?php /*= stripslashes($item->title); */ ?> " src="<?php /*= Config::get('site.uploads_dir') . '/images/' . $value */ ?> " />--> <?php echo cl_image_tag(Constant::FOLDER_CLOUDINARY . '/' . $value, array('alt' => stripslashes($item->title), 'class' => 'single-media')); ?> </a> <?php } ?> <?php } } ?> <?php } else { ?> <div class="video_container <?php
?> </a> <form style="margin-top: 10px" role="form" method="POST" action="{{ url('/property/photo/'.$images[$i]->id) }}"> {{ csrf_field() }} {{ method_field('DELETE') }} <button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure? This is irreversible. ');">Delete this photo</button> </form> <?php $i++; ?> @endif </td> <td> @if ($i < count($images)) <a href="{{ $images[$i]->url }}"><?php echo cl_image_tag($images[$i]->cloudinary_public_id, array("width" => 400, "height" => 200, "crop" => "fill")); ?> </a> <form style="margin-top: 10px" role="form" method="POST" action="{{ url('/property/photo/'.$images[$i]->id) }}"> {{ csrf_field() }} {{ method_field('DELETE') }} <button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure? This is irreversible. ');">Delete this photo</button> </form> <?php $i++; ?> @endif </td> </tr> @endfor </tbody>
public function test_dpr_auto() { // should support width=auto $tag = cl_image_tag("hello", array("dpr" => "auto", "format" => "png")); $this->assertEquals("<img class='cld-hidpi' data-src='http://res.cloudinary.com/test123/image/upload/dpr_auto/hello.png'/>", $tag); }