/**
  * @param DownloadSession $downloadSession
  *
  * @return resource
  */
 public function resizeLogo(DownloadSession $downloadSession)
 {
     $suffix = "x" . $downloadSession->getWidth();
     // Get new sizes
     $image = $this->createImage($downloadSession->getLogo(), $suffix);
     $width = imagesx($image);
     $height = imagesy($image);
     $percent = $downloadSession->getWidth() / $width;
     $percent = round($percent, 4);
     $newwidth = round($width * $percent);
     $newheight = round($height * $percent);
     // Resize
     $resize = imagecreatetruecolor($newwidth, $newheight);
     imagealphablending($resize, false);
     imagesavealpha($resize, true);
     $transparent = imagecolorallocatealpha($resize, 255, 255, 255, 127);
     imagefilledrectangle($resize, 0, 0, $newwidth, $newheight, $transparent);
     imagecopyresampled($resize, $image, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
     //Far better quality than the other one
     $logopath = $this->renameWithSuffix($downloadSession->getLogo()->getWebPath(), $suffix);
     // Output and free memory
     imagepng($resize, $logopath);
     return $resize;
 }