original_string: public function gdResourceToTruecolor(&$resource)
      {
          $width = imagesx($resource);
          $height = imagesy($resource);
  
          // new canvas
          $canvas = imagecreatetruecolor($width, $height);
  
          // fill with transparent color
          imagealphablending($canvas, false);
          $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
          imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
          imagecolortransparent($canvas, $transparent);
          imagealphablending($canvas, true);
  
          // copy original
          imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
          imagedestroy($resource);
  
          $resource = $canvas;
  
          return true;
      }
code: public function gdResourceToTruecolor(&$resource)
      {
          $width = imagesx($resource);
          $height = imagesy($resource);
  
          // new canvas
          $canvas = imagecreatetruecolor($width, $height);
  
          // fill with transparent color
          imagealphablending($canvas, false);
          $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
          imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
          imagecolortransparent($canvas, $transparent);
          imagealphablending($canvas, true);
  
          // copy original
          imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
          imagedestroy($resource);
  
          $resource = $canvas;
  
          return true;
      }
code_tokens: public function gdResourceToTruecolor ( & $ resource ) { $ width = imagesx ( $ resource ) ; $ height = imagesy ( $ resource ) ; // new canvas $ canvas = imagecreatetruecolor ( $ width , $ height ) ; // fill with transparent color imagealphablending ( $ canvas , false ) ; $ transparent = imagecolorallocatealpha ( $ canvas , 255 , 255 , 255 , 127 ) ; imagefilledrectangle ( $ canvas , 0 , 0 , $ width , $ height , $ transparent ) ; imagecolortransparent ( $ canvas , $ transparent ) ; imagealphablending ( $ canvas , true ) ; // copy original imagecopy ( $ canvas , $ resource , 0 , 0 , 0 , 0 , $ width , $ height ) ; imagedestroy ( $ resource ) ; $ resource = $ canvas ; return true ; }
docstring: Transform GD resource into Truecolor version
  
  @param  resource $resource
  @return bool
docstring_tokens: Transform GD resource into Truecolor version