Skip to content

Conversation

sccalabr
Copy link
Contributor

@sccalabr sccalabr commented Oct 7, 2023

This is an example of how to use transofrormations and effects in php. The
example generates an image like https://res.cloudinary.com/dozm52czt/image/upload/c_fill,h_600,w_600/a_180/e_sepia/e_cartoonify/v1/samples/smile.jpg?_a=BAAAROBs
Resolves #88

@colbyfayock
Copy link
Collaborator

definitely on the right track!

as far as how to run this, im not totally sure, im not quite familiar with the PHP front, but i did find this:

https://www.php.net/manual/en/features.commandline.usage.php#example-474

if i update the code to:

#!/usr/bin/php
<?php
use Cloudinary\Cloudinary;

$cld = new Cloudinary();
echo $cld->image('samples/smile.jpg')
  ->resize(Resize::fill()->width(600)->height(600))->gravity(Gravity::autoGravity())
  ->overlay(Overlay::source(Source::image('examples:sale-tag'))->transformation((new ImageTransformation())->resize(Resize::crop()->width(100)->height(100))));
?>

I'm able to run it, however...

I then get this error:

image

that's even after running composer install

here are two things i would also recommend before wrapping up:

  • For the Pull Request, make sure to have a title and description that match what you're adding. this is pretty standard across any contribution you make with OSS
  • Update the README file that describes how to run it, though i think that would likely be applicable after you figure that part out 😁

@colbyfayock
Copy link
Collaborator

you might need to make the script executable through composer scripts, apparently a property in the composer config file

@sccalabr
Copy link
Contributor Author

sccalabr commented Oct 8, 2023

you might need to make the script executable through composer scripts, apparently a property in the composer config file

Would that help me find the missing class? I dont get my the compose isnt pulling in the class. I think my issue is php composer.phar install doesnt work. Says could not open composer.phar

I am guessing ill need a cloud configuration and that it will take some time to provision because I created one and tried to run the php file and says to please set up the environment even though I am using the config from the portal

@colbyfayock colbyfayock changed the title Does this look right PHP Transformations and effects Oct 9, 2023
@colbyfayock
Copy link
Collaborator

@sccalabr im not too sure. i'm not familiar with php / composer and how that works, was just trying to google around a little bit to help

i wouldn't expect to need to do any cloud configuring or provisioning

i would try to google running composer scripts with dependencies. id be surprised if you can't find examples

@sccalabr
Copy link
Contributor Author

Will do. I'll look more into it this weekend.

@colbyfayock
Copy link
Collaborator

hey @sccalabr i was able to run this code from the terminal: #95

it looks like maybe the solution here is the line in the script that uses "autoload" - worth checking out!

@sccalabr
Copy link
Contributor Author

I guess assign it back to me and ill take a look later tonight

@colbyfayock
Copy link
Collaborator

awesome, no rush!

@vercel
Copy link

vercel bot commented Oct 13, 2023

@sccalabr is attempting to deploy a commit to the Cloudinary DevX Team on Vercel.

A member of the Team first needs to authorize it.

@sccalabr
Copy link
Contributor Author