芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/sommatv/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php
gdResourceToTruecolor($core); // build image $image = $this->initFromGdResource($core); $image->mime = $mime; $image->setFileInfoFromPath($path); return $image; } /** * Initiates new image from GD resource * * @param Resource $resource * @return \Intervention\Image\Image */ public function initFromGdResource($resource) { return new Image(new Driver, $resource); } /** * Initiates new image from Imagick object * * @param Imagick $object * @return \Intervention\Image\Image */ public function initFromImagick(\Imagick $object) { throw new \Intervention\Image\Exception\NotSupportedException( "Gd driver is unable to init from Imagick object." ); } /** * Initiates new image from binary data * * @param string $data * @return \Intervention\Image\Image */ public function initFromBinary($binary) { $resource = @imagecreatefromstring($binary); if ($resource === false) { throw new \Intervention\Image\Exception\NotReadableException( "Unable to init from given binary data." ); } $image = $this->initFromGdResource($resource); $image->mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $binary); return $image; } /** * Transform GD resource into Truecolor version * * @param resource $resource * @return bool */ 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; } }