Rotation of Image from UPS in PHP

I was recently implementing UPS API for PHP.

I found those two great sources from Gabriel Bull or simple one from Alex Fraundhof.

When I ask to get the shipping Label by

$Response = $ShipperObj->createLabel($params);

the result is label that is rotated by 90 degrees to the right.


I didn’t found any parameter to get the label rotated as I want.

Following code will rotate the label back. The source of the labe is in base64 and so the result of my function:

 if ($image) {
  $image=imagerotate($image, 270, 0);
  if ($image===FALSE) {
  } else { 
 } else {


NOTE: imagecreatefromgif with the text parameters requires allow_url_fopen to be on. If you have it off, you need to convert the base64 manually and then open the image as binary.

Leave a Reply

Your email address will not be published. Required fields are marked *