/**
  * crops a image identified by an imgageURL and returns a new tempFileImage
  * 
  * @param  string $imageurl imageURL of the image to be croped
  * @param  int    $left     left position of crop window
  * @param  int    $top      top  position of crop window
  * @param  int    $widht    widht  of crop window
  * @param  int    $height   heidht of crop window
  * @return string imageURL of new temp image
  * 
  */
 public function cropImage($imageurl, $left, $top, $widht, $height)
 {
     $this->checkAuth();
     $image = Tinebase_Model_Image::getImageFromImageURL($imageurl);
     Tinebase_ImageHelper::crop($image, $left, $top, $widht, $height);
 }
 /**
  * saveRecordWithImage
  */
 public function testSaveRecordWithImage()
 {
     // create TEMPFILE and save in inv item
     $imageFile = dirname(dirname(dirname(dirname(__FILE__)))) . '/tine20/images/cancel.gif';
     $tempImage = Tinebase_TempFile::getInstance()->createTempFile($imageFile);
     $imageUrl = Tinebase_Model_Image::getImageUrl('Tinebase', $tempImage->getId(), 'tempFile');
     $invItem = $this->_getInventoryItem()->toArray();
     $invItem['image'] = $imageUrl;
     $savedInvItem = $this->_json->saveInventoryItem($invItem);
     //$savedInvItem = $this->_json->getInventoryItem($savedInvItem['id']);
     $this->assertTrue(!empty($savedInvItem['image']), 'image url is empty');
     $this->assertTrue(preg_match('/location=vfs&id=([a-z0-9]*)/', $savedInvItem['image']) == 1, print_r($savedInvItem, true));
     // check if favicon is delivered
     $image = Tinebase_Model_Image::getImageFromImageURL($savedInvItem['image']);
     $this->assertEquals(52, $image->width);
 }