Comments (12)
I just tried running your code under cakephp 2.4.1 and php 5.4 and it works fine (with the exception that the App::import calls should not have .php in them). What versions of php and cakephp are you using?
from cloudinary_php.
I'm using 5.4.19 and 2.4.1. Note: I'm using the method inside of a CakePHP element. Also, I installed the Cloudinary files via Composer.
using "cloudinary/cloudinary_php": "dev-master",
from cloudinary_php.
Works for me inside an element as well.
Do you have the following files in your project?
app/Vendor/Cloudinary/Api.php
app/Vendor/Cloudinary/Cloudinary.php
app/Vendor/Cloudinary/Uploader.php
app/Vendor/Cloudinary/cacert.pem
Did you modify them in any way?
Can you try to call this method from elsewhere (controller, regular view, etc.)?
from cloudinary_php.
How are you loading these in? I haven't modified anything. I can call cl_image_tag
elsewhere, but not cl_image_upload_tag
. I don't have cacert.pem
loading into my project via require or import. To my knowledge that wasn't listed in the docs.
My folder structure looks like:
from cloudinary_php.
Try to copy only the contents of the src directory to app/Vendor/cloudinary
Load them using:
App::import('Vendor', 'Cloudinary/Cloudinary');
App::import('Vendor', 'Cloudinary/Uploader');
App::import('Vendor', 'Cloudinary/Api');
from cloudinary_php.
I ended up using the following and it has gotten me passed the cl_image_tag_upload
error. Now I'm getting the following.
Invalid preloaded file info
Error:
An Internal Error Has Occurred.
Code reference in view element is below.
echo cl_image_upload_tag("fileName", array(
"callback" => $cors_location
));
$preloaded = new \Cloudinary\PreloadedFile($_POST['fileName']);
if (!$preloaded->is_valid()) {
echo "Invalid upload signature";
} else {
$photo->image_identifier = $preloaded->identifier();
echo cl_image_tag($photo["public_id"], array(
"format" => "jpg",
"crop" => "fill",
"width" => 120,
"height" => 120
));
}
from cloudinary_php.
Looks like $_POST['fileName'] is null which causes an error when trying to construct the PreloadedFile from it.
from cloudinary_php.
Yep, just realized that.
Added
if(isset($_POST['fileName']) && !empty($_POST['fileName'])){
$preloaded = new \Cloudinary\PreloadedFile($_POST['fileName']);
if (!$preloaded->is_valid()) {
echo "Invalid upload signature";
} else {
$photo->image_identifier = $preloaded->identifier();
echo cl_image_tag($photo["public_id"], array(
"format" => "jpg",
"crop" => "fill",
"width" => 120,
"height" => 120,
"name" => "fileName"
));
}
}
to fix the issue. Now I'm realizing that the cl_image_upload_tag doesn't allow you to pass along an id or class. So much for customizing the look of the input. :(
EDIT: Man, I must be really sleepy, I just realized that all I need to do is just use existing classes that are assigned.
from cloudinary_php.
BTW: Thanks for all of the help. It seems to be working now!
from cloudinary_php.
You can use:
cl_image_upload_tag("fileName", array("callback" => $cors_location, "html"=>array("class"=>"myclass", "id"=>"myid")))
from cloudinary_php.
Beautiful, thanks again.
from cloudinary_php.
Happy to help :)
from cloudinary_php.
Related Issues (20)
- PHP 8.1 support HOT 5
- Migrate from Travis to GitHub actions HOT 2
- Add PHPStan HOT 1
- Wrong CLOUDINARY_URL HOT 3
- Why does the response I'm getting not reflect the documentation's format? HOT 5
- Missing a way to easily request every asset type HOT 18
- Deprecated: fopen(): Passing null to parameter #3 ($use_include_path) of type bool is deprecated (php 8.1) HOT 1
- Update access mode method not available in SDK HOT 10
- [2.7.1] Why separate package and failure on composer-require-checker HOT 1
- Fatal Error on PHP 7.4 HOT 2
- Bad signature when public id contains commas HOT 5
- Error using defaultvalues in class SetMetadataField HOT 1
- Incorrect URL generated when Public ID of MediaAsset ends with dot + 1-5 characters HOT 3
- ${var} -> {$var} for PHP 8.2 compatibility in version 1.x HOT 5
- Deprecations on PHP 8.2 HOT 1
- Call to undefined function GuzzleHttp\Promise\promise_for() HOT 3
- Get rid of `teapot-php/status-code` dependency HOT 9
- Drop Guzzle requirement and replace with any PSR-18 HttpClient
- Use named parameters instead of array in Version 3 HOT 1
- Class 'Cloudinary\ClassUtils' not found HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudinary_php.