public function save($path) { @imageinterlace($this->mImage, true); if (@imagepng($this->mImage, $path) !== true) { throw new \Exception(' " imagepng " fail'); } }
/** * Configure or check the image's properties * * @return void */ private function _prepareImage($file) { $imagetype = exif_imagetype($file); switch ($imagetype) { case IMAGETYPE_JPEG: $path = sys_get_temp_dir() . '/' . uniqid() . '.jpg'; $image = imagecreatefromjpeg($file); imageinterlace($image, false); imagejpeg($image, $path); imagedestroy($image); break; case IMAGETYPE_PNG: $path = sys_get_temp_dir() . '/' . uniqid() . '.png'; $image = imagecreatefrompng($file); imageinterlace($image, false); imagesavealpha($image, true); imagepng($image, $path); imagedestroy($image); break; default: throw new Exception("Unsupported image type"); break; } return $path; }
/** * Renders a scaled version of the image referenced by the provided filename, taken any (optional) manipulators into consideration. * @param String $sourceData The binary data of the original source image. * @param Array $scaleParams * @param Int $imageType One of the PHP image type constants, such as IMAGETYPE_JPEG * @return Array * ['resource'] The image file data string * ['mime'] Mime type of the generated cache file * ['timestamp'] Timestamp of the generated cache file **/ public function scale($sourceData, $scaleParams, $imageType) { $this->_setInputParams($scaleParams); $mem = new Garp_Util_Memory(); $mem->useHighMemory(); if (strlen($sourceData) == 0) { throw new Exception("This is an empty file!"); } if (!($source = imagecreatefromstring($sourceData))) { $finfo = new finfo(FILEINFO_MIME); $mime = $finfo->buffer($sourceData); throw new Exception("This source image could not be scaled. It's probably not a valid file type. Instead, this file is of the following type: " . $mime); } $this->_analyzeSourceImage($source, $imageType); $this->_addOmittedCanvasDimension(); if ($this->_isFilterDefined($scaleParams)) { Garp_Image_Filter::filter($source, $scaleParams['filter']); } if ($this->_isSourceEqualToTarget($scaleParams)) { $outputImage = $sourceData; } else { $canvas = $this->_createCanvasImage($imageType); $this->_projectSourceOnCanvas($source, $canvas); // Enable progressive jpegs imageinterlace($canvas, true); $outputImage = $this->_renderToImageData($canvas); imagedestroy($canvas); } $output = array('resource' => $outputImage, 'mime' => $this->params['mime'], 'timestamp' => time()); imagedestroy($source); return $output; }
function saveImage() { /* store a memoryimage to file */ if (!$this->_imageStream) { throw new Lms_ImageProcessor_Exception('image not loaded'); } switch ($this->_type) { case 1: /* store a interlaced gif image */ if ($this->_interlace === true) { imageinterlace($this->_imageStream, 1); } imagegif($this->_imageStream, $this->_sFileLocation); break; case 2: /* store a progressive jpeg image (with default quality value)*/ if ($this->_interlace === true) { imageinterlace($this->_imageStream, 1); } imagejpeg($this->_imageStream, $this->_sFileLocation, $this->_jpegQuality); break; case 3: /* store a png image */ imagepng($this->_imageStream, $this->_sFileLocation); break; default: throw new Lms_ImageProcessor_Exception('invalid imagetype'); if (!file_exists($this->_sFileLocation)) { throw new Lms_ImageProcessor_Exception('file not stored'); } } }
/** * MÉTODO CONSTRUTOR * * @author Gibran */ function Imagem($arquivo) { if (is_file($arquivo)) { $this->Arquivo = $arquivo; // OBTÉM OS DADOS DA IMAGEM $this->ColecaoDados = getimagesize($this->Arquivo); // CARREGA A IMAGEM DE ACORDO COM O TIPO switch ($this->ColecaoDados[2]) { case 1: $this->Recurso = imagecreatefromgif($this->Arquivo); $this->Tipo = "image/gif"; break; case 2: $this->Recurso = imagecreatefromjpeg($this->Arquivo); $this->Tipo = "image/jpeg"; imageinterlace($this->Recurso, true); break; case 3: $this->Recurso = imagecreatefrompng($this->Arquivo); $this->Tipo = "image/png"; imagealphablending($this->Recurso, false); imagesavealpha($this->Recurso, true); break; default: $this->ColecaoDados = null; $this->Recurso = null; $this->Tipo = null; return null; break; } } else { return null; } }
public function save($imgname, $type = NULL, $interlace = true) { if (empty($this->img)) { throw new Exception("没有可以被保存的图像资源"); } if (is_null($type)) { $type = $this->info["type"]; } else { $type = strtolower($type); } if ("jpeg" == $type || "jpg" == $type) { $type = "jpeg"; imageinterlace($this->img, $interlace); } if ("gif" == $type && !empty($this->gif)) { $this->gif->save($imgname); } else { $fun = "image{$type}"; if (!LOCAL) { $temp = Ibos::engine()->IO()->file()->fetchTemp(FileUtil::fileName($imgname), $this->info["type"]); $fun($this->img, $temp); $content = file_get_contents($temp); Ibos::engine()->IO()->file()->writeFile($imgname, $content); } else { $fun($this->img, $imgname); } } }
function setColorPalette($input, $output, $clut) { $gd = null; if (file_exists($input)) { $gd = imagecreatefrompng($input); } else { throw new Exception("Unable to apply color-table: {$input} does not exist."); } if (!$gd) { throw new Exception("Unable to apply color-table: {$input} is not a valid image."); } $ctable = imagecreatefrompng($clut); for ($i = 0; $i <= 255; $i++) { $rgb = imagecolorat($ctable, 0, $i); $r = $rgb >> 16 & 0xff; $g = $rgb >> 8 & 0xff; $b = $rgb & 0xff; imagecolorset($gd, $i, $r, $g, $b); } // Enable interlacing imageinterlace($gd, true); imagepng($gd, $output); // Cleanup if ($input != $output) { unlink($input); } imagedestroy($gd); imagedestroy($ctable); }
/** * 保存图像 * @param string $imgname 图像保存名称 * @param string $type 图像类型 * @param boolean $interlace 是否对JPEG类型图像设置隔行扫描 */ public function save($imgname, $type = null, $interlace = true) { if (empty($this->im)) { throw new \Exception('没有可以被保存的图像资源'); } //自动获取图像类型 if (is_null($type)) { $type = $this->info['type']; } else { $type = strtolower($type); } //JPEG图像设置隔行扫描 if ('jpeg' == $type || 'jpg' == $type) { $type = 'jpeg'; imageinterlace($this->im, $interlace); } //保存图像 if ('gif' == $type && !empty($this->gif)) { $this->gif->save($imgname); } else { $fun = "image{$type}"; $fun($this->im, $imgname); } return $this; }
public function get($type = 'png', $interlace = false, $quality = NULL, $filter = PNG_ALL_FILTERS) { $type = strtolower($type); if ($interlace === true) { imageinterlace($this->image, 1); } ob_start(); switch ($type) { case 'png': $quality = $quality === NULL ? 9 : max(0, min(9, (int) $quality)); imagepng($this->image, NULL, $quality, $filter); break; case 'jpeg': $quality = $quality === NULL ? 100 : max(0, min(100, (int) $quality)); imagejpeg($this->image, NULL, $quality); break; case 'gif': $quality = $quality === NULL ? 255 : max(0, min(255, (int) $quality)); $temp = imagecreatetruecolor($this->width, $this->height); imagecopy($temp, $this->image, 0, 0, 0, 0, $this->width, $this->height); imagetruecolortopalette($temp, false, $quality); imagecolormatch($this->image, $temp); imagegif($temp); break; } return trim(ob_get_clean()); }
function image_make_thumbnail($image, $maxx = 100, $maxy = 100) { //header("Content-type: image/jpeg"); /* $i = imagick_create(); imagick_read($i, $image); $w = imagick_get_attribute($i, 'width'); $h = imagick_get_attribute($i, 'height'); */ $i = imagecreatefromjpeg($image); $w = imagesx($i); $h = imagesy($i); $r = (double) $w / (double) $h; if ($w >= $h) { $nw = $maxx; $nh = $maxy / $r; } else { $nh = $maxy; $nw = $maxx * $r; } $o = imagecreatetruecolor($nw, $nh); imageinterlace($o, true); imagecopyresampled($o, $i, 0, 0, 0, 0, $nw, $nh, $w, $h); imagejpeg($o); /* $o = imagick_copy_sample($i, $nw, $nh); imagick_dump($o, "JPEG"); */ }
/** * Displays the image * * @param integer $quality image render quality 1-100, default 100 * @access public * @return void */ function render($quality = 100) { header('Content-type: image/' . $this->type); @imageinterlace($this->handle, 1); @imagegif($this->handle, NULL, $quality); @imagedestroy($this->handle); }
public function run($file) { $progressive = isset($this->settings['field_settings']['progressive_jpeg']) === TRUE && $this->settings['field_settings']['progressive_jpeg'] == 'yes' ? TRUE : FALSE; $this->size = getimagesize($file); $width = $this->size[0]; $height = $this->size[1]; if (isset($this->settings['only_if']) === TRUE) { // Do we need to rotate? if ($this->settings['only_if'] == 'width_bigger' && $width < $height) { return TRUE; } elseif ($this->settings['only_if'] == 'height_bigger' && $height < $width) { return TRUE; } } switch ($this->size[2]) { case 1: if (imagetypes() & IMG_GIF) { $this->im = imagecreatefromgif($file); } else { return 'No GIF Support!'; } break; case 2: if (imagetypes() & IMG_JPG) { $this->im = imagecreatefromjpeg($file); } else { return 'No JPG Support!'; } break; case 3: if (imagetypes() & IMG_PNG) { $this->im = imagecreatefrompng($file); } else { return 'No PNG Support!'; } break; default: return 'File Type??'; } $this->settings['background_color']; $this->settings['degrees']; $this->im = imagerotate($this->im, 360 - $this->settings['degrees'], hexdec($this->settings['background_color'])); switch ($this->size[2]) { case 1: imagegif($this->im, $file); break; case 2: if ($progressive === TRUE) { @imageinterlace($this->im, 1); } imagejpeg($this->im, $file, 100); break; case 3: imagepng($this->im, $file); break; } imagedestroy($this->im); return TRUE; }
private function saveImage($quality = 100) { if ($quality < 70 || $quality > 100) { $quality = 100; } if (ThumbImage::IMAGEINTERLACE) { imageinterlace($this->ImageStream, 1); } imagejpeg($this->ImageStream, $this->sFileLocation, $quality); }
/** * resize file $source and save the resized image into $destination * * @param string $source file to resize * @param string $destination resized file * @throws ImageResizerException */ public function resize($source, $destination) { list($srcWidth, $srcHeight) = $this->retrieveSrcDimensions($source); list($dstWidth, $dstHeight) = $this->calculateDstDimensions($srcWidth, $srcHeight); $srcId = $this->getImageIdentifier($source); $dstId = @imagescale($srcId, $dstWidth, $dstHeight, IMG_BILINEAR_FIXED); @imageinterlace($dstId, $this->getOption(self::OPT_INTERLACE)); $this->save($dstId, $destination); @imagedestroy($dstId); }
public function write() { if ($this->mime['mime'] == "image/png") { imageinterlace($this->image); imagesavealpha($this->image, true); imagepng($this->image, $this->cache); } else { imagejpeg($this->image, $this->cache, 85); } @chmod($this->cache, 0775); }
function do_image_open($filename) { // Disable interlacing for the generated images, as we do not need progressive images // if PDF files (futhermore, FPDF does not support such images) $image = do_image_open_wrapped($filename); if (!is_resource($image)) { return null; } if (!is_null($image)) { imageinterlace($image, 0); } return $image; }
public function __construct($image, $text) { $this->array = $text; $this->image = $image; imageinterlace($this->image, TRUE); foreach ($text as $key => $word) { $space = " "; if ($key == 0) { $space = ""; } $this->text .= $space . $word; } }
function img_downsize($old_fn, $new_fn, $max_w, $max_h, $crop = 0, $q = 75, $interlace = 0) { list($old_w, $old_h, $type) = getimagesize($old_fn); // Make sure we have enough memory if the image is large if (max($old_w, $old_h) > 1024) { // this won't work on all servers but it's worth a try ini_set('memory_limit', EXTRA_MEMORY); } $old_img = null; if ($type == 1) { $old_img = imagecreatefromgif($old_fn); } elseif ($type == 2) { $old_img = imagecreatefromjpeg($old_fn); } elseif ($type == 3) { $old_img = imagecreatefrompng($old_fn); } if (!$old_img) { trigger_error('error_loading_image', array('{file}' => $old_fn)); return false; } $newsize = img_newsize($old_w, $old_h, $max_w, $max_h, $crop); if (!$newsize) { trigger_error('invalid_size', array('{w}' => $max_w, '{h}' => $max_h)); return false; } list($dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) = $newsize; $new_img = imagecreatetruecolor($dst_w, $dst_h); if (imagecopyresampled($new_img, $old_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)) { $r = false; if (file_exists($new_fn)) { unlink($new_fn); } if ($type == 1) { imagetruecolortopalette($new_img, false, 255); $r = imagegif($new_img, $new_fn); } elseif ($type == 2) { imageinterlace($new_img, $interlace); $r = imagejpeg($new_img, $new_fn, $q); } elseif ($type == 3) { $r = imagepng($new_img, $new_fn, $q); } if (!$r) { trigger_error('error_creating_new_image', array('{file}' => $old_fn)); } return $r; } else { trigger_error('error_creating_new_image', array('{file}' => $old_fn)); return false; } }
private function gdResize() { // @TODO rename to resizeGD // GD lib $src_im = $this->inputImageFile->gdCreateImage(); $dst_im = imagecreatetruecolor($this->newWidth, $this->newHeight); // imageCopyResampled( imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $this->newWidth, $this->newHeight, $this->inputImageFile->width, $this->inputImageFile->height); imageinterlace($dst_im, 1); // progressive JPEG imagejpeg($dst_im, $this->cacheFileName, $this->quality); imagedestroy($src_im); imagedestroy($dst_im); }
function resizeImage($image, $width, $height, $scale) { $newImageWidth = ceil($width * $scale); $newImageHeight = ceil($height * $scale); $newImage = imagecreatetruecolor($newImageWidth, $newImageHeight); $ext = strtolower(substr(basename($image), strrpos(basename($image), ".") + 1)); $source = ""; if ($ext == 'jpeg') { $ext = 'jpg'; } switch ($ext) { case 'bmp': $source = imagecreatefromwbmp($image); break; case 'gif': $source = imagecreatefromgif($image); break; case 'jpg': $source = imagecreatefromjpeg($image); break; case 'png': $source = imagecreatefrompng($image); break; } // preserve transparency if ($ext == "gif" or $ext == "png") { imagecolortransparent($source, imagecolorallocatealpha($source, 0, 0, 0, 127)); imagealphablending($newImage, false); imagesavealpha($newImage, true); } imagecopyresampled($newImage, $source, 0, 0, 0, 0, $newImageWidth, $newImageHeight, $width, $height); imageinterlace($newImage, true); switch ($ext) { case 'bmp': imagewbmp($newImage, $image); break; case 'gif': imagegif($newImage, $image); break; case 'jpg': imagejpeg($newImage, $image, 100); break; case 'png': imagepng($newImage, $image, 0); break; } chmod($image, 0777); return $image; }
public function thumb($image, $thumbname, $maxWidth = 200, $maxHeight = 50, $interlace = true) { $info = self::getImageInfo($image); if ($info !== false) { $srcWidth = $info['width']; $srcHeight = $info['height']; $type = strtolower($info['type']); $interlace = $interlace ? 1 : 0; unset($info); $scale = min($maxWidth / $srcWidth, $maxHeight / $srcHeight); if ($scale >= 1) { $width = $srcWidth; $height = $srcHeight; } else { $width = (int) ($srcWidth * $scale); $height = (int) ($srcHeight * $scale); } $createFun = 'ImageCreateFrom' . ($type == 'jpg' ? 'jpeg' : $type); $srcImg = $createFun($image); if ($type != 'gif' && function_exists('imagecreatetruecolor')) { $thumbImg = imagecreatetruecolor($width, $height); } else { $thumbImg = imagecreate($width, $height); } if (function_exists("ImageCopyResampled")) { imagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0, $width, $height, $srcWidth, $srcHeight); } else { imagecopyresized($thumbImg, $srcImg, 0, 0, 0, 0, $width, $height, $srcWidth, $srcHeight); } if ('gif' == $type || 'png' == $type) { $background_color = imagecolorallocate($thumbImg, 0, 255, 0); imagecolortransparent($thumbImg, $background_color); } if ('jpg' == $type || 'jpeg' == $type) { imageinterlace($thumbImg, $interlace); } $dir = dirname($thumbname); if (!is_dir($dir)) { mkdirs($dir); } $imageFun = 'image' . ($type == 'jpg' ? 'jpeg' : $type); $imageFun($thumbImg, $thumbname); imagedestroy($thumbImg); imagedestroy($srcImg); return $thumbname; } return false; }
function loadpng($imgurl) { $x = new connector($imgurl); try { $im = imagecreatefromstring($x->file); } catch (Exception $E) { $e = new mb_exception("Can't read image from string: " . $E->getmessage); } if (!$im) { $im = false; $e = new mb_exception("SaveLegend: unable to load image: " . $imgurl); } imageinterlace($im, 0); return $im; imagedestroy($im); }
function do_image_open($filename, &$type) { // Gracefully process missing GD extension if (!extension_loaded('gd')) { return null; } // Disable interlacing for the generated images, as we do not need progressive images // if PDF files (futhermore, FPDF does not support such images) $image = do_image_open_wrapped($filename, $type); if (!is_resource($image)) { return null; } if (!is_null($image)) { imageinterlace($image, 0); } return $image; }
function OutputResizedImage($width, $height) { global $_JAM; // Determine output size $autoWidth = round($this->width * ($height / $this->height)); $autoHeight = round($this->height * ($width / $this->width)); if ($width && $height) { // Fixed width and height $canvasWidth = $width; $canvasHeight = $height; if ($this->width > $this->height) { // Wide image $imageWidth = $autoWidth; $imageHeight = $height; } else { // Tall image $imageWidth = $width; $imageHeight = $autoHeight; } } elseif ($width && !$height) { // Fixed width, auto height $canvasWidth = $imageWidth = $width; $canvasHeight = $imageHeight = $autoHeight; } elseif (!$width && $height) { // Fixed height, auto width $canvasWidth = $imageWidth = $autoWidth; $canvasHeight = $imageHeight = $height; } else { // No dimensions were provided return false; } // Create image object $outputObject = imagecreatetruecolor($canvasWidth, $canvasHeight); // Resize image and copy/resize into image object $xCoordinate = round(-($imageWidth - $canvasWidth) / 2); $yCoordinate = round(-($imageHeight - $canvasHeight) / 2); imagecopyresampled($outputObject, $this->sourceObject, $xCoordinate, $yCoordinate, 0, 0, $imageWidth, $imageHeight, $this->width, $this->height); // Set MIME type to JPEG header('Content-type: image/jpeg'); // We want a progressive JPEG imageinterlace($outputObject, true); // Output image imagejpeg($outputObject, null, 90); return true; }
public static function svg_dom_to_gd($dom, $format) { if (extension_loaded('gd') && function_exists('imagettftext') && $dom->childNodes->item(2)->nodeName == 'svg') { $width = $dom->childNodes->item(2)->attributes->getNamedItem('width')->nodeValue; $height = $dom->childNodes->item(2)->attributes->getNamedItem('height')->nodeValue; if ($width > 1 && $height > 1) { $gd = imagecreatetruecolor($width, $height); if (!isset($_REQUEST['svg_dom_gd_no_interlacing'])) { // PHP FPDF fails on image interlacing imageinterlace($gd, true); } if (function_exists('imageantialias')) { imageantialias($gd, true); } } else { return false; } //foreach($dom->childNodes->item(2)->attributes as $atrr) // { echo $atrr->name . ' ' . $atrr->value . PHP_EOL; } } else { // If the first tag isn't an svg tag, chances are something is broke... return false; } self::$color_table = array(); foreach ($dom->childNodes->item(2)->childNodes as $node) { self::evaluate_node($node, $gd); // imagejpeg($this->image, $output_file, $quality); //var_dump($node->attributes); } $tmp_output = tempnam('/tmp', 'pts-gd'); switch ($format) { case 'JPEG': imagejpeg($gd, $tmp_output, 100); $output = file_get_contents($tmp_output); unlink($tmp_output); break; case 'PNG': imagepng($gd, $tmp_output, 1); $output = file_get_contents($tmp_output); unlink($tmp_output); break; } return $output; }
function create_image(&$image) { if ($image != NULL) { $type = get_extension($this->path); imageinterlace($image, 0); if ($type == 'gif' and IMAGEGIF) { imagegif($image, $this->path); imagedestroy($image); } elseif (($type == 'png' or $type == 'gif') and IMAGEPNG) { imagepng($image, $this->path); imagedestroy($image); } elseif (IMAGEJPEG) { imagejpeg($image, $this->path, 70); imagedestroy($image); } else { $this->create_error($this->lang['tne_badtype']); } } }
function jpgresize($in_file, $out_file, $larger) { $old_img = imagecreatefromjpeg($in_file); $old_img_size = getimagesize($in_file); if ($old_img_size[0] >= $old_img_size[1]) { $new_size_w = $larger; $new_size_h = $old_img_size[1] * $larger / $old_img_size[0]; } else { $new_size_h = $larger; $new_size_w = $old_img_size[0] * $larger / $old_img_size[1]; } $img_new = imagecreatetruecolor($new_size_w, $new_size_h); imagecopyresampled($img_new, $old_img, 0, 0, 0, 0, $new_size_w, $new_size_h, $old_img_size[0], $old_img_size[1]); imageinterlace($img_new, 1); imagejpeg($img_new, $out_file, 100); imagedestroy($img_new); # убить объект, но не файл imagedestroy($old_img); }
private function saveImage($quality = 100) { if ($quality < 70 || $quality > 100) { $quality = 100; } if (EnBacImage::IMAGEINTERLACE) { imageinterlace($this->ImageStream, 1); } imagejpeg($this->ImageStream, $this->sFileLocation, $quality); /*switch($this->type){ case 1: if (EnBacImage::IMAGEINTERLACE){imageinterlace($this->ImageStream, 1);} imagegif($this->ImageStream,$this->sFileLocation);break; case 2: if (EnBacImage::IMAGEINTERLACE){imageinterlace($this->ImageStream, 1);} imagejpeg($this->ImageStream,$this->sFileLocation,100);break; default: imagepng($this->ImageStream,$this->sFileLocation);break; }*/ }
function save_image($image, $file, $ext = false) { if ($ext == false) { $ext = substr($file, strrpos($file, ".") + 1); $ext = strtolower($ext); } imageinterlace($image, true); if ($ext == "jpg" || $ext == "jpeg") { imagejpeg($image, $file); } if ($ext == "png") { imagepng($image, $file); } if ($ext == "bmp") { imagebmp($image, $file); } if ($ext == "gif") { imagegif($image, $file); } return true; }
private function image_resize($source_path, $destination_path, $newwidth, $newheight = false, $quality = false) { ini_set("gd.jpeg_ignore_warning", 1); list($oldwidth, $oldheight, $type) = getimagesize($source_path); switch ($type) { case IMAGETYPE_JPEG: $typestr = 'jpeg'; break; case IMAGETYPE_GIF: $typestr = 'gif'; break; case IMAGETYPE_PNG: $typestr = 'png'; break; } $function = "imagecreatefrom{$typestr}"; $src_resource = $function($source_path); if (!$newheight) { $newheight = round($newwidth * $oldheight / $oldwidth); } elseif (!$newwidth) { $newwidth = round($newheight * $oldwidth / $oldheight); } $destination_resource = imagecreatetruecolor($newwidth, $newheight); //Водяной знак $watermark = imagecreatefrompng($this->watermark); list($mark_width, $mark_height) = getimagesize($this->watermark); imagecopyresampled($src_resource, $watermark, 0, 0, 0, 0, $mark_width, $mark_height, $mark_width, $mark_height); imagecopyresampled($destination_resource, $src_resource, 0, 0, 0, 0, $newwidth, $newheight, $oldwidth, $oldheight); if ($type = 2) { imageinterlace($destination_resource, 1); // чересстрочное формирование изображение imagejpeg($destination_resource, $destination_path, $quality); } else { $function = "image{$typestr}"; $function($destination_resource, $destination_path); } imagedestroy($destination_resource); imagedestroy($src_resource); }