jrm2k6 / cloudder Goto Github PK
View Code? Open in Web Editor NEWCloudinary wrapper for Laravel 5
License: MIT License
Cloudinary wrapper for Laravel 5
License: MIT License
I know that the documentation in this repo says it works for Laravel 5. That said, I was trying to use this in a Lumen 5.4 project and fails when trying to register the service provider:
Fatal error: Call to undefined method Laravel\Lumen\Application::share() in /var/www/nike/vendor/jrm2k6/cloudder/src/JD/Cloudder/CloudderServiceProvider.php on line 41
this is exactly at:
public function register()
{
$this->app['cloudder'] = $this->app->share(function ($app) {
return new CloudinaryWrapper($app['config'], new Cloudinary, new Cloudinary\Uploader, new Cloudinary\Api);
});
}
Any ideas if that app->share()
can be changed to something else?
Thanks!
It would be great if this library would have a method to download files as zip.
http://cloudinary.com/documentation/image_upload_api_reference#generate_archive
Hi, I've implemented your wrapper and tested it for the last days and I love it. I have only one question and is how to add the "multiple files upload" feature?. I've read the documentation and it mention the $options array to add additional features, but in this case how could I do it?
Thanks
I'm really loving your Cloudder lib, and I'll be using it for a few of our corporate projects. One thing I want to add is a specified base url for uploads, so that all files, by default, get uploaded to a subdirectory in cloudinary (for example, I could specify CLOUDINARY_BASE_UPLOAD_URL=/marketing/
to upload all pictures to a marketing folder on cloudinary.
Similarly, I'd like to also implement CLOUDINARY_TAGS_ON_UPLOAD
, which would specify a list of tags applied to all uploads - of course, more could be specified on each individual one, but in my case, I could - for example - add marketingmedia
tag to all uploads without specifying it.
Are those things you'd accept a PR for if I implemented them in the main library, or should I just implement my own simple wrapper?
I get the following error when I try to use Cloudder::upload($file, $file_id)
method: Invalid Signature d4cc2506fe374f2c10de3de3368964825acac78e. String to sign - 'public_id=1737aa5b068205e4de112932503b844a8bf62fe5×tamp=1528755130'.
Is there a way to have a fallback if 404 on Cloudinary?
AFAIK Cloudinary class will just generate the full URL, not make any request to check if the resource is available.
However, I'd like to have a fallback if the remote image is not found so I can display the local version of it. Unfortunately, this might imply making an extra request per image and will consume more bandwidth.
What do you think?
I created this function
Cloudder::upload($image, $path, array("width"=>150, "height"=>150, "crop"=>"scale") );
But it not work
Hi,
i am using laravel 5.5 and using 0.4.* cloudder. when i upload image my server to cloudinary server error return " Upload preset must be specified when using unsigned upload ".
i want to display the pdf file that i uploaded to cloudinary server.but it is always showing png file.how can i read pdf file.
i am unable to delete files using the methods provided. Here is my code:
Cloudder::delete($publicId, null);
Or
Cloudder::delete($publicId, array('folder' => 'users/'));
no error but when i check my dashboard file is still there.
Getting Server returned unexpected status code - 0 - when i am trying to upload any image. Here is my code
Cloudder::upload($filename, null);
Hello,
I've been working with the library and it works really well.
Just for curiosity, I added my fork to codeclimate, and it suggests to reduce the amount of methods on CloudinaryWrapper.php
The link: https://codeclimate.com/github/rogervila/cloudder/issues
Do you think that moving the methods into traits could be a good idea?
This are the current badges:
Hi,
why does secureShow()
return '/image/upload/c_fit,h_150,w_150/myImage1.png' instead of '/image/upload/v1550480678/myImage1.jpg'
The second link, I get from opening the cloudinary console directly.
I ran php artisan vendor:publish --provider="JD\Cloudder\CloudderServiceProvider"
and
I have commented out the scaling in my config/cloudder.php
, so the returned url is : '/image/upload/myImage1'
So then, how to include the versioning on the returned result?
Thanks
Hey guys, am having issue uploading audio to Cloudinary. I use the Method bleow
$file = $request->file('file')->getRealPath();
Cloudder::upload($file, null, ['resource_type' => 'video']);
$song_url = Cloudder::secureShow(Cloudder::getPublicId());
// the value of $song_url == "https://res.cloudinary.com/mad237/image/upload/c_fit,h_150,w_150/tqgd6r6jpquhqq5hbmua.png"
Please i need your help the file am uploading is an audio file.
Latest release: https://github.com/cloudinary/cloudinary_php/releases/tag/1.11.1
Hi there,
I keep getting this issue when trying to upload.
All configurations are set and cross-checked.
this is a sample of my code
public function test (Request $request) { if ($request->hasFile('file')) { \Cloudder::upload($request->file('file'), ["timeout" => 60, "folder" => "folder"]); $c=\Cloudder::getResult(); if($c){ return $c['url']; return back() ->with('success','You have successfully upload images.') ->with('image',$c['url']); } } else { return 'false'; } }
Hello there, im following this guide to upload an image to Cloudinary through your wrapper, but i cant figure it out why am i getthing this error:
Cloudinary \ Error (401)
Invalid Signature 5cdab5056b3a64970e330834c0bd3288dea25a8b. String to sign - 'timestamp=1516097941'.
Any suggestions how i can solve this?
Below you can find the complete code of what im executing right now that is giving me that error.
Route
Route::post('/upload-image',[
'uses' => 'CloudderController@uploadFile',
'as' => 'upload'
]);
Controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class CloudderController extends Controller
{
public function getFile(){
return view('welcome');
}
public function uploadFile(Request $request){
if($request->hasFile('input_img')){
\Cloudder::upload($request->file('input_img'));
$c=\Cloudder::getResult();
if($c){
return back()
->with('success','You have successfully upload images.')
->with('image',$c['url']);
}
}
}
}
Web form
<form action="{{route('upload') }}" method="post" enctype="multipart/form-data">
<input type="hidden" value="{{ csrf_token() }}" name="_token">
<label>Select image to upload:</label>
<input type="file" name="input_img" id="input_img">
<input type="submit" value="Upload" name="submit">
</form>
Thank you, Afterspace
Good day,
Please, how can i upload to a specific folder on cloudinary. For example, if i have a folder name banners, how can i upload images directly from my laravel code to banners folder? Thanks
As title, how do you create a folder (with name) on upload.
E.g. /profiles/{user}/avatar/{avatar}.jpg
GIF images return PNG when using the Show
method. Like this image
https://res.cloudinary.com/codehelper/image/upload/c_fit,h_538,w_538/NDda9oGEDR3LY.png
I want to return it as
https://res.cloudinary.com/codehelper/image/upload/c_fit,h_538,w_538/NDda9oGEDR3LY.gif
I original documentation we can pass the folder/file.jpg and it uploads the file in that particular folder. But in this wrapper when i pass like so it treats it as file name .
Please tell me the solution . I needed it urgently.
Could you move the
vendor:publish
below
Add the following in config/app.php:
Because vendor:publish will not work until the façade is added to config/app.php
I used the function Cloudder::upload in php and intended to return it and get the url of the image, It responded with the json of an empty api.
Note: the image is successfully saved in cloudinary
now I know there is a workaround by calling secureShow method, just wanted to make sure if it is possible to return the upload function right away
See #7
Hello, I want to list all resources from Cloudinary.
I have seen that this method is not declared in CloudinaryWrapper
. If you agree, I'd like to add all the API endpoints to the wrapper.
Also, in order to make it simple, I'd follow the same API names in camel case.
For example, destroyImages
method is calling delete_resources
from api. I'd change the name to deleteResources
(of course I'd mantain the current method names as an alias in order to keep compatibility)
If you agree I can make the PR. Thank you very much for this package.
Just wondering if there's a way to add secure => true
to the options array globaly so that all requests are made using HTTPS? If not, would it be possible to add this in? Happy to submit a PR.
Hi Jeremy,
I'm getting error:
InvalidArgumentException in Cloudinary.php line 648:
Must supply api_key
I have all keys in .inv file and in config/cloudder.php
I go over your file and cannot get how you populate self:config?
maybe the issue is here:
public static function reset_config() {
self::config_from_url(getenv("CLOUDINARY_URL"));
}
what is CLOUDINARY_URL? I don't have it.
Hi, I have this package implemented in my Laravel Application (Laravel 5.7.25) and the image upload is working well but the Video upload is not working for me. The following is my image upload code which works perfectly:
$id = Auth::user()->id;
$name = $request->input('name');
$email = $request->input('email');
$about = $request->input('about');
$profile_picture = $request->file('profile_picture')->getRealPath();
Cloudder::upload($profile_picture, null);
list($width, $height) = getimagesize($profile_picture);
$image_url = Cloudder::show(Cloudder::getPublicId(), ["width" => $width, "height"=>$height]);
$data = array('name' => $name,'email' => $email,'about' => $about,'profile_picture' => $image_url);
User::where('id', $id)->update($data);
return redirect('/dashboard')->with('response','Profile Updated Succesfully!');
The following is my video upload code which returns the following error: Error in sending request to server - read function returned funny value
$user_id = Auth::user()->id;
$video_title = $request->input('video_title');
$video_description = $request->input('video_description');
$video_url = $request->file('video_url')->getRealPath();
Cloudder::uploadVideo($video_url, null);
$vid_url = Cloudder::show(Cloudder::getPublicId());
$data = array('user_id' => $user_id, 'video_title' => $video_title, 'video_description' => $video_description, 'video_url' => $vid_url);
VideoResume::save($data);
return redirect('/my-video-resumes')->with('response','Profile Published Succesfully!');
Any assistance in figuring out the issue will highly be appreciated. Thanks.
2 errors on update:
Warning: Ambiguous class resolution, "Cloudinary\Akamai" was found in both "vendor/cloudinary/cloudinary_php/src/Akamai.php" and "vendor/cloudinary/cloudinary_php/src/Cloudinary/Akamai.php", the first will be used.
> post-update-cmd: php artisan optimize
[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method Illuminate\Foundation\Application::share()
Script php artisan optimize handling the post-update-cmd event returned with error code 1
So far all documentation is pointing to upload locally (or to s3) then download (upload) to cloudinary.
I am trying
try{
Cloudder::upload($request->file('profile_picture'),
null,
array("format" => "jpg", "crop" => "crop", "x" => 0, "y" => 0, "width" => 200, "height" => 200,"crop" => "thumb", "gravity" => "face", )
);
}
catch(Exception $e){
return 'invalid';
}
i am trying to upload a invalid file (abc.txt) so it must come in catch but i get HTTP/1.1 500 Internal Server Error
I face below problem in terminal when i run
Run php artisan vendor:publish --provider="JD\Cloudder\CloudderServiceProvider"
Command. Please Help me on this.
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'JD\Cloudder\CloudderServiceProvider' not found
Hi @jrm2k6 please is it possible to achieve on the fly (OTF) transformation using this package? If yes, can you provide an example on how to? Thanks so much
Is there support for unsigned_upload like \Cloudinary\Uploader::unsigned_upload ?
Hello I'm trying to do something like :
Cloudder::upload($filename);
$c=Cloudder::getResult();
dd($c);
in my controller but I get error message "Must supply api_key", I don't get where the problem came from, I specified my api key, my secret api and the cloud name.. Can I get any help please?
ssss
Hi!
the default scaling is
'scaling' => [
'format' => 'png',
'width' => 150,
'height' => 150,
'crop' => 'fit',
'effect' => null
],
So when I want to show an image - using Cloudder::show()
-, it will take these default values unless I change them in each photo show command.
But sometimes I don't know the height or the width. I need to make them = auto to solve this problem.
How can I do that?
Thanks !
etettetete
I'm receiving an Unknown API key error upon trying to upload.
Cloudder::upload("/var/www/laravel/test-images/Clear_1.png", "RAND-" . mt_rand(1000,9999), array(), array('tag1','tag2'));
(1/1) ErrorUnknown API key `REDACTED`
--
in Uploader.php (line 344)
at Uploader::call_api('upload', array('timestamp' => 1500481508, 'public_id' => 'RAND-8820', 'tags' => 'tag1,tag2', 'signature' => '6e07ace689cf36b7fa03b3ebefa2346ca1cd010d', 'api_key' => '`REDACTED`'), array('public_id' => 'RAND-8820', 'tags' => array('tag1', 'tag2')), '/var/www/laravel/test-images/Clear_1.png')in Uploader.php (line 63)
at Uploader::upload('/var/www/laravel/test-images/Clear_1.png', array('public_id' => 'RAND-8820', 'tags' => array('tag1', 'tag2')))in CloudinaryWrapper.php (line 122)
at CloudinaryWrapper->upload('/var/www/laravel/test-images/Clear_1.png', 'RAND-8820', array(), array('tag1', 'tag2'))in Facade.php (line 221)
[...]
I have it properly defined in my .env file, and REDACTED
is properly showing my API key as found in the dashboard.
Hi There,
There seems to be an issue with the show method handling secure URLs. The website has an SSL certificate installed and everything is working, but the images served up by Cloudinary using this package aren't loading with a secure URL.
I've tried to force the URL within config/cloudder.php
and also within the .env
file setting the CLOUDINARY_BASE_URL
to use HTTPS.
Please let me know if I've missed something.
Thank you,
Kris
This is not an issue per say. I was just wondering how video upload would be implemented, it was not mentioned in the README. In my application, i had two file uploaders, one for image upload and the other for video upload. Whenever i try to do both uploads at the same time, i get token mismatch exception but when i do an image upload only it works just fine. I am surely missing out on something, would could that be???
Thanks
The package ktquez/lumen-image is preventing installation of this package
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.