Archived from the Transloadit support forum. Originally posted on March 4, 2014; details may be outdated, see our docs for current behavior. Original thread
Hi, I’ve followed the instructions in the API docs and I’m using the example PHP code for creating the signature but I get an INVALID_SIGNATURE error:
$(function() {
// We reference our html form here
$('#upload-form').transloadit({
// We want to wait for all encodings to finish before the form
// is submitted.
wait: true,
// The upload to Transloadit should start as soon as the user
// selects some files.
triggerUploadOnFileSelection: true,
signature: "<?php echo $signature?>",
params: {
auth: {
// This is your API key.
key: "REDACTED",
expires: "<?php echo $expires ?>"
},
// Our assembly instructions just contain two steps for now.
// You can name the steps how you like.
steps: {
// The first step resizes the uploaded image(s) to 125x125 pixels.
// The /image/resize robots ignores any files that are not images
// automatically.
resize_to_125: {
robot: "/image/resize",
use: ":original",
width: 125,
height: 125
},
// The second step resizes the results further to 75x75 pixels.
// Notice how we "use" the output files of the "resize_to_125"
// step as our input here. We could use all kinds of steps with
// various robots that "use" each other, making this perfect for
// any workflow.
resize_to_75: {
robot: "/image/resize",
use: "resize_to_125",
width: 75,
height: 75,
// We also add a sepia effect here just for fun.
// The /image/resize robot has a ton of available parameters.
sepia: 80
}
}
}
});
});
The docs does say how to do it correct, but I think what misled me was the PHP example (2.7.2 PHP) where $params only includes the ‘auth’ field. Might make it easier to grasp if the example also includes “steps” like the listing in 2.4?