C# - get an image through image cropper in Umbraco

I created a helper method. you can put this function somewhere in your project :

public static string GetImageCropByID(int imageId, string cropSize)
{
    string returnImage = "";
    if (imageId != null)
    {
string tmpImage = (new umbraco.cms.businesslogic.media.Media(imageId).getProperty("umbracoFile").Value).ToString();
returnImage = tmpImage;
if (!string.IsNullOrEmpty(cropSize))
{
   Media photo = uQuery.GetMedia(imageId);
   string cropImage = photo.GetImageCropperUrl("cropextended", cropSize);
   if (!String.IsNullOrEmpty(cropImage))
returnImage = cropImage;
}
    }
    return returnImage;
}