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

@colbyfayock I think I got it working!

@colbyfayock
Copy link
Collaborator

hey @sccalabr i pushed a commit with some tweaks: a45b7cd

I set up dotenv to work and technically you're not doing an overlay here, you're doing some effects, so i updated the name appropriately and removed unneeded imports

going to merge this in! thanks for the help here

@colbyfayock colbyfayock merged commit 60f2ce3 into cloudinary-community:main Oct 13, 2023
@colbyfayock
Copy link
Collaborator

@all-contributors please add @sccalabr for code

@allcontributors
Copy link
Contributor

@colbyfayock

I've put up a pull request to add @sccalabr! 🎉

@colbyfayock
Copy link
Collaborator

@sccalabr congrats on the merged PR! since it was merged during Hacktoberfest, you're eligible for some free swag. Please email [email protected] with your Github username and a link to this PR where we'll follow up with you there.

https://cloudinary.com/blog/hacktoberfest-celebrate-open-source-sdks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants