當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Imagick::setBackgroundColor方法代碼示例

本文整理匯總了PHP中Imagick::setBackgroundColor方法的典型用法代碼示例。如果您正苦於以下問題:PHP Imagick::setBackgroundColor方法的具體用法?PHP Imagick::setBackgroundColor怎麽用?PHP Imagick::setBackgroundColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Imagick的用法示例。


在下文中一共展示了Imagick::setBackgroundColor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getThumbnail

	/**
	 * {@inheritDoc}
	 */
	public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
		try {
			$svg = new \Imagick();
			$svg->setBackgroundColor(new \ImagickPixel('transparent'));

			$content = stream_get_contents($fileview->fopen($path, 'r'));
			if (substr($content, 0, 5) !== '<?xml') {
				$content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content;
			}

			// Do not parse SVG files with references
			if (stripos($content, 'xlink:href') !== false) {
				return false;
			}

			$svg->readImageBlob($content);
			$svg->setImageFormat('png32');
		} catch (\Exception $e) {
			\OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
			return false;
		}

		//new image object
		$image = new \OC_Image();
		$image->loadFromData($svg);
		//check if image object is valid
		if ($image->valid()) {
			$image->scaleDownToFit($maxX, $maxY);

			return $image;
		}
		return false;
	}
開發者ID:ninjasilicon,項目名稱:core,代碼行數:36,代碼來源:svg.php

示例2: alfath_svg_compiler

function alfath_svg_compiler($options)
{
    global $wp_filesystem;
    if (!class_exists('Imagick')) {
        return new WP_Error('class_not_exist', 'Your server not support imagemagick');
    }
    $im = new Imagick();
    $im->setBackgroundColor(new ImagickPixel('transparent'));
    if (empty($wp_filesystem)) {
        require_once ABSPATH . '/wp-admin/includes/file.php';
        WP_Filesystem();
    }
    $file = get_template_directory() . '/assets/img/nav.svg';
    $target = get_template_directory() . '/assets/img/nav-bg.png';
    if ($wp_filesystem->exists($file)) {
        //check for existence
        $svg = $wp_filesystem->get_contents($file);
        if (!$svg) {
            return new WP_Error('reading_error', 'Error when reading file');
        }
        //return error object
        $svg = preg_replace('/fill="#([0-9a-f]{6})"/', 'fill="' . $options['secondary-color'] . '"', $svg);
        $im->readImageBlob($svg);
        $im->setImageFormat("png24");
        $im->writeImage($target);
        $im->clear();
        $im->destroy();
    } else {
        return new WP_Error('not_found', 'File not found');
    }
}
開發者ID:ArgiaCyber,項目名稱:alfath,代碼行數:31,代碼來源:functions.php

示例3: getThumbnail

 public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
 {
     $mimetype = $fileview->getMimeType($path);
     $path = \OC_Helper::mimetypeIcon($mimetype);
     $path = \OC::$SERVERROOT . substr($path, strlen(\OC::$WEBROOT));
     $svgPath = substr_replace($path, 'svg', -3);
     if (extension_loaded('imagick') && file_exists($svgPath) && count(@\Imagick::queryFormats("SVG")) === 1) {
         // http://www.php.net/manual/de/imagick.setresolution.php#85284
         $svg = new \Imagick();
         $svg->readImage($svgPath);
         $res = $svg->getImageResolution();
         $x_ratio = $res['x'] / $svg->getImageWidth();
         $y_ratio = $res['y'] / $svg->getImageHeight();
         $svg->removeImage();
         $svg->setResolution($maxX * $x_ratio, $maxY * $y_ratio);
         $svg->setBackgroundColor(new \ImagickPixel('transparent'));
         $svg->readImage($svgPath);
         $svg->setImageFormat('png32');
         $image = new \OC_Image();
         $image->loadFromData($svg);
     } else {
         $image = new \OC_Image($path);
     }
     return $image;
 }
開發者ID:olucao,項目名稱:owncloud-core,代碼行數:25,代碼來源:unknown.php

示例4: resize

 public function resize($file, $size = array('width' => 100, 'height' => 100), $type = 'png', $fixed = false)
 {
     $image = new Imagick($this->file);
     $image->setBackgroundColor(new ImagickPixel('transparent'));
     $image->setImageFormat($type);
     if ($fixed === true) {
         $newWidth = $size['width'];
         $newHeight = $size['height'];
     } else {
         $imageprops = $image->getImageGeometry();
         $width = $imageprops['width'];
         $height = $imageprops['height'];
         if ($width > $height) {
             $newHeight = $size['height'];
             $newWidth = $size['height'] / $height * $width;
         } else {
             $newWidth = $size['width'];
             $newHeight = $size['width'] / $width * $height;
         }
     }
     $image->resizeImage($newWidth, $newHeight, imagick::FILTER_LANCZOS, 1);
     $image->writeImage($file . '.' . $type);
     $image->clear();
     $image->destroy();
 }
開發者ID:Nnamso,項目名稱:tbox,代碼行數:25,代碼來源:thumb.php

示例5: convert

 public function convert(string $file, Conversion $conversion = null) : string
 {
     $imageFile = pathinfo($file, PATHINFO_DIRNAME) . '/' . pathinfo($file, PATHINFO_FILENAME) . '.jpg';
     $image = new \Imagick();
     $image->readImage($file);
     $image->setBackgroundColor(new ImagickPixel('none'));
     $image->setImageFormat('jpg');
     file_put_contents($imageFile, $image);
     return $imageFile;
 }
開發者ID:spatie,項目名稱:laravel-medialibrary,代碼行數:10,代碼來源:Svg.php

示例6: upload

 function upload()
 {
     // Default settings/restrictions
     $config['upload_path'] = $this->directory;
     $config['allowed_types'] = 'gif|jpg|png|jpeg';
     $config['max_size'] = min(maxUploadSizeBytes() / 1024, self::MAX_FILE_SIZE_KB);
     $config['max_width'] = '0';
     // no restriction (image will be resized anyway!)
     $config['max_height'] = '0';
     $config['max_filename'] = self::MAX_FILE_NAME_LEN;
     $this->load->library('upload', $config);
     // Try and upload the file using the settings from __construct()
     if (!$this->upload->do_upload('new_file')) {
         // Abort upload and display errors, if any
         $data['error_message'] = $this->upload->display_errors();
         $data['recent_uploads'] = $this->getRecentUploads();
         $data['title'] = "Image Uploader";
         $data['js_lib'] = array('core');
         $this->load->view('uploader', $data);
     } else {
         // Create the compressed copy of the image based on a hash of the uploaded filename
         $upload_result = $this->upload->data();
         $image = new Imagick($this->directory . $upload_result['file_name']);
         $image->setBackgroundColor(new ImagickPixel('white'));
         // Create the optimised image
         // "bestfit" param will ensure that the image is downscaled proportionally if needed
         // if ($image->getImageWidth() >= $image->getImageHeight()
         // 	&& $image->getImageWidth() > self::IMAGE_LANDSCAPE_WIDTH || $image->getImageHeight() > self::IMAGE_LANDSCAPE_HEIGHT)
         // {
         // 	$image->resizeImage(self::IMAGE_LANDSCAPE_WIDTH,self::IMAGE_LANDSCAPE_HEIGHT, Imagick::FILTER_LANCZOS, 1, true);
         // }
         // else if ($image->getImageWidth() > self::IMAGE_PORTRAIT_WIDTH || $image->getImageHeight() > self::IMAGE_PORTRAIT_HEIGHT)
         // {
         // 	$image->resizeImage(self::IMAGE_PORTRAIT_WIDTH,self::IMAGE_PORTRAIT_HEIGHT, Imagick::FILTER_LANCZOS, 1, true);
         // }
         $flattened = new IMagick();
         $flattened->newImage($image->getImageWidth(), $image->getImageHeight(), new ImagickPixel("white"));
         $flattened->compositeImage($image, imagick::COMPOSITE_OVER, 0, 0);
         $flattened->setImageFormat("jpg");
         $flattened->setImageCompression(Imagick::COMPRESSION_JPEG);
         // $flattened->setCompression(Imagick::COMPRESSION_JPEG);
         // $flattened->setCompressionQuality(self::COMPRESSION_PERCENTAGE);
         $flattened->writeImage($this->directory . 'img_' . md5($upload_result['file_name']) . ".jpg");
         $flattened->clear();
         $flattened->destroy();
         $image->clear();
         $image->destroy();
         $data['success_message'] = "File successfully uploaded!";
         $data['recent_uploads'] = $this->getRecentUploads();
         $data['title'] = "Image Uploader";
         $data['js_lib'] = array('core');
         $data['max_filesize'] = $config['max_size'];
         $this->load->view('uploader', $data);
     }
 }
開發者ID:aaryani,項目名稱:RD-Switchboard-Net,代碼行數:55,代碼來源:uploader.php

示例7: removeAlpha

 /**
  * @param  null|string $backgroundColor
  *
  * @throws ProcessorException
  *
  * @returns $this
  */
 public function removeAlpha($backgroundColor = null)
 {
     $backgroundColor = $backgroundColor === null ? 'white' : $backgroundColor;
     try {
         $this->im->setBackgroundColor($backgroundColor);
         $this->im->setImageAlphaChannel($this->getLibraryConstant('ALPHACHANNEL_REMOVE', null, 11));
     } catch (\Exception $e) {
         throw new ProcessorException('Could not remove alpha channel: %s', null, $e, (string) $e->getMessage());
     }
     return $this;
 }
開發者ID:scr-be,項目名稱:teavee-image-magic-bundle,代碼行數:18,代碼來源:ImageMagickProcessor.php

示例8: _imageResizeAndSave

 protected function _imageResizeAndSave($object)
 {
     $path = APPLICATION_ROOT . '/public_html/images/eyecatchers/';
     $system->lng = $this->_getParam('lng');
     $adapter = new Zend_File_Transfer_Adapter_Http();
     $adapter->setDestination($path);
     $adapter->setOptions(array('ignoreNoFile' => true));
     if (!$adapter->receive()) {
         $msgr = Sanmax_MessageStack::getInstance('SxModule_Eyecatchers_Validator');
         $msgr->addMessage('file', $adapter->getMessages(), 'title');
     }
     if ($object->getPicture() == null) {
         $object->setPicture('');
     }
     $files = $adapter->getFileInfo();
     foreach ($files as $file) {
         if (!$file['tmp_name']) {
             continue;
         }
         $path0 = $path . "253x115/";
         $path1 = $path . "980x450/";
         if (!is_dir($path0)) {
             mkdir($path0, 0777, true);
         }
         if (!is_dir($path1)) {
             mkdir($path1, 0777, true);
         }
         $filename = $object->createThumbName($file['name']) . '_' . time() . '.png';
         $image = new Imagick($file['tmp_name']);
         $image->cropThumbnailImage(253, 115);
         $image->setCompression(Imagick::COMPRESSION_JPEG);
         $image->setImageCompressionQuality(100);
         $image->setBackgroundColor(new ImagickPixel('transparent'));
         $image->setImageFormat('png32');
         $image->writeImage($path0 . $filename);
         $image->clear();
         $image->destroy();
         $image = new Imagick($file['tmp_name']);
         $image->cropThumbnailImage(980, 450);
         $image->setCompression(Imagick::COMPRESSION_JPEG);
         $image->setImageCompressionQuality(75);
         $image->setBackgroundColor(new ImagickPixel('transparent'));
         $image->setImageFormat('png32');
         $image->writeImage($path1 . $filename);
         $image->clear();
         $image->destroy();
         unlink($file['tmp_name']);
         $object->setPicture($filename);
     }
 }
開發者ID:sonvq,項目名稱:2015_freelance6,代碼行數:50,代碼來源:EyecatchersController.php

示例9: initFromPath

 /**
  * Initiates new image from path in filesystem
  *
  * @param  string $path
  * @return \Intervention\Image\Image
  */
 public function initFromPath($path)
 {
     $core = new \Imagick();
     try {
         $core->setBackgroundColor(new \ImagickPixel('transparent'));
         $core->readImage($path);
         $core->setImageType(\Imagick::IMGTYPE_TRUECOLORMATTE);
     } catch (\ImagickException $e) {
         throw new \Intervention\Image\Exception\NotReadableException("Unable to read image from path ({$path}).", 0, $e);
     }
     // build image
     $image = $this->initFromImagick($core);
     $image->setFileInfoFromPath($path);
     return $image;
 }
開發者ID:nbarazarte,項目名稱:neeladmintroovami,代碼行數:21,代碼來源:Decoder.php

示例10: Imagick

 function __construct($src, $dst, $flatten)
 {
     parent::__construct($dst);
     if ($src instanceof Strass_Vignette_Imagick) {
         $image = $src->image;
     } else {
         $image = new Imagick();
         $image->setBackgroundColor(new ImagickPixel('transparent'));
         $image->readImage($src);
         if ($flatten) {
             $photo = $image;
             $image = new Imagick();
             $image->newImage($photo->getImageWidth(), $photo->getImageHeight(), "white");
             $image->compositeImage($photo, Imagick::COMPOSITE_OVER, 0, 0);
         }
     }
     $this->image = $image;
 }
開發者ID:bersace,項目名稱:strass,代碼行數:18,代碼來源:Vignette.php

示例11: setThumbnails

 private function setThumbnails()
 {
     $thumbnailsToCreate = ['small', 'large'];
     foreach ($thumbnailsToCreate as $size) {
         $lengthDimension = $size == 'small' ? $this->smallThumbnailSize : $this->largeThumbnailSize;
         // PDFs, One day learn to extract thumbnails for all the other media types too
         if ($this->fileinfo['filetype'] == 'pdf' && $this->fileinfo['mime'] == 'application/pdf') {
             $image = new \Imagick(public_path() . '/' . $this->directory['full'] . $this->fileinfo['filename'] . '[0]');
             // Use PNG because: http://stackoverflow.com/questions/10934456/imagemagick-pdf-to-jpgs-sometimes-results-in-black-background
             $image->setImageFormat('png');
             $image->setBackgroundColor(new \ImagickPixel('white'));
             $image->thumbnailImage($lengthDimension, $lengthDimension, true);
             // http://php.net/manual/en/imagick.flattenimages.php#101164
             $image = $image->flattenImages();
             $image->setImageFormat('jpg');
             $image->writeImage(public_path() . '/' . $this->directory[$size] . $this->fileinfo['filename_without_extension'] . '.jpg');
         }
     }
 }
開發者ID:RoryStolzenberg,項目名稱:spacexstats,代碼行數:19,代碼來源:DocumentUpload.php

示例12: get

 /**
  * Get the svg as an image
  *
  * @return \Imagecow\Image
  */
 public function get($width = 0, $height = 0)
 {
     $imageWidth = $this->image->getImageWidth();
     $imageHeight = $this->image->getImageHeight();
     if ($width !== 0 && ($height === 0 || $imageWidth / $width > $imageHeight / $height)) {
         $height = ceil($width / $imageWidth * $imageHeight);
     } elseif ($height !== 0) {
         $width = ceil($height / $imageHeight * $imageWidth);
     } else {
         $width = $imageWidth;
         $height = $imageHeight;
     }
     $image = new \Imagick();
     $image->setBackgroundColor(new \ImagickPixel('transparent'));
     $image->setResolution($width, $height);
     $blob = $this->image->getImageBlob();
     $blob = preg_replace('/<svg([^>]*) width="([^"]*)"/si', '<svg$1 width="' . $width . 'px"', $blob);
     $blob = preg_replace('/<svg([^>]*) height="([^"]*)"/si', '<svg$1 height="' . $height . 'px"', $blob);
     $image->readImageBlob($blob);
     $image->setImageFormat("png");
     return new \Imagecow\Image(new \Imagecow\Libs\Imagick($image));
 }
開發者ID:marcha,項目名稱:imagecow,代碼行數:27,代碼來源:SvgExtractor.php

示例13: createImage

 /**
  * Generate a derivative image with Imagick.
  */
 public function createImage($sourcePath, $destPath, $type, $sizeConstraint, $mimeType)
 {
     $page = (int) $this->getOption('page', 0);
     try {
         $imagick = new Imagick($sourcePath . '[' . $page . ']');
     } catch (ImagickException $e) {
         _log("Imagick failed to open the file. Details:\n{$e}", Zend_Log::ERR);
         return false;
     }
     $origX = $imagick->getImageWidth();
     $origY = $imagick->getImageHeight();
     $imagick->setImagePage($origX, $origY, 0, 0);
     $imagick->setBackgroundColor('white');
     $imagick->setImageBackgroundColor('white');
     $imagick = $imagick->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);
     if ($type != 'square_thumbnail') {
         $imagick->thumbnailImage($sizeConstraint, $sizeConstraint, true);
     } else {
         // We could use cropThumbnailImage here but it lacks support for
         // the gravity setting
         if ($origX < $origY) {
             $newX = $sizeConstraint;
             $newY = $origY * ($sizeConstraint / $origX);
             $offsetX = 0;
             $offsetY = $this->_getCropOffsetY($newY, $sizeConstraint);
         } else {
             $newY = $sizeConstraint;
             $newX = $origX * ($sizeConstraint / $origY);
             $offsetY = 0;
             $offsetX = $this->_getCropOffsetX($newX, $sizeConstraint);
         }
         $imagick->thumbnailImage($newX, $newY);
         $imagick->cropImage($sizeConstraint, $sizeConstraint, $offsetX, $offsetY);
         $imagick->setImagePage($sizeConstraint, $sizeConstraint, 0, 0);
     }
     $imagick->writeImage($destPath);
     $imagick->clear();
     return true;
 }
開發者ID:kyfr59,項目名稱:omeka-cg35,代碼行數:42,代碼來源:Imagick.php

示例14: resizeAndSave

 public function resizeAndSave()
 {
     $path = APPLICATION_ROOT . '/public_html/images/doctors/';
     if (!is_dir($path)) {
         mkdir($path, 0777, true);
     }
     $adapter = new Zend_File_Transfer_Adapter_Http();
     $adapter->setDestination($path);
     $adapter->setOptions(array('ignoreNoFile' => true));
     if (!$adapter->receive()) {
         $msgr = Sanmax_MessageStack::getInstance('SxModule_Doctor');
         $msgr->addMessage('file', $adapter->getMessages(), 'file');
     }
     $files = $adapter->getFileInfo();
     foreach ($files as $file) {
         if ($file['tmp_name'] == '') {
             continue;
         }
         $filename = $this->_doc->createThumbName($file['name']) . '_' . time() . '.png';
         $path0 = $path . "100x100/";
         $path1 = $path . "230x230/color/";
         $path2 = $path . "230x230/fade/";
         $path3 = $path . "110x110/color/";
         $path4 = $path . "110x110/fade/";
         if (!is_dir($path0)) {
             mkdir($path0, 0777, true);
         }
         if (!is_dir($path1)) {
             mkdir($path1, 0777, true);
         }
         if (!is_dir($path2)) {
             mkdir($path2, 0777, true);
         }
         if (!is_dir($path3)) {
             mkdir($path3, 0777, true);
         }
         if (!is_dir($path4)) {
             mkdir($path4, 0777, true);
         }
         $image = new Imagick($file['tmp_name']);
         $image->cropThumbnailImage(100, 100);
         $image->setCompression(Imagick::COMPRESSION_JPEG);
         $image->setImageCompressionQuality(100);
         $image->setBackgroundColor(new ImagickPixel('transparent'));
         $image->setImageFormat('png32');
         $image->writeImage($path0 . $filename);
         $image->clear();
         $image->destroy();
         $image1 = new Imagick($file['tmp_name']);
         $image1->cropThumbnailImage(230, 230);
         $image1->setCompression(Imagick::COMPRESSION_JPEG);
         $image1->setImageCompressionQuality(100);
         $image1->setBackgroundColor(new ImagickPixel('transparent'));
         $image1->setImageFormat('png32');
         $image1->writeImage($path1 . $filename);
         $image1->setimagetype(Imagick::IMGTYPE_GRAYSCALE);
         $image1->writeImage($path2 . $filename);
         $image1->clear();
         $image1->destroy();
         $image1 = new Imagick($file['tmp_name']);
         $image1->cropThumbnailImage(110, 110);
         $image1->setCompression(Imagick::COMPRESSION_JPEG);
         $image1->setImageCompressionQuality(100);
         $image1->setBackgroundColor(new ImagickPixel('transparent'));
         $image1->setImageFormat('png32');
         $image1->writeImage($path3 . $filename);
         $image1->setimagetype(Imagick::IMGTYPE_GRAYSCALE);
         $image1->writeImage($path4 . $filename);
         $image1->clear();
         $image1->destroy();
         unlink($file['tmp_name']);
         $this->_doc->setPhoto($filename);
     }
 }
開發者ID:sonvq,項目名稱:2015_freelance6,代碼行數:74,代碼來源:DoctorController.php

示例15: diyAction

 public function diyAction()
 {
     Yaf_Dispatcher::getInstance()->autoRender(FALSE);
     $id = $this->_req->getQuery('id', 1);
     if ($this->_req->isPost()) {
         $this->diy = new DiyModel();
         $pre_svg = '<?xml version="1.0" standalone="no" ?>' . trim($_POST['svg_val']);
         $rdate = APPLICATION_PATH . '/public/Uploads/' . date("Ymd", time());
         //文件名
         if (!file_exists($rdate)) {
             chmod(APPLICATION_PATH . '/public/Uploads/', 0777);
             mkdir($rdate);
             //創建目錄
         }
         $savename = $this->create_unique();
         $path = $rdate . '/' . $savename;
         if (!($file_svg = fopen($path . '.svg', 'w+'))) {
             echo "不能打開文件 {$path}.'.svg'";
             exit;
         }
         if (fwrite($file_svg, $pre_svg) === FALSE) {
             echo "不能寫入到文件 {$path}.'.svg'";
             exit;
         }
         echo "已成功寫入";
         fclose($file_svg);
         //$path= APPLICATION_PATH . '/public/Uploads/' . date("Ymd", time()) .'/m-1';
         //添加圖片轉化
         $im = new Imagick();
         $im->setBackgroundColor(new ImagickPixel('transparent'));
         $svg = file_get_contents($path . '.svg');
         $im->readImageBlob($svg);
         $im->setImageFormat("png");
         $am = $im->writeImage($path . '.png');
         $im->thumbnailImage(579, 660, true);
         /* 改變大小 */
         $ams = $im->writeImage($path . '-t.png');
         $im->clear();
         $im->destroy();
         //圖片加水印
         $waterpath = APPLICATION_PATH . '/public/source/source.png';
         $im1 = new Imagick($waterpath);
         $im2 = new Imagick($path . '.png');
         $im2->thumbnailImage(600, 600, true);
         $dw = new ImagickDraw();
         $dw->setGravity(5);
         $dw->setFillOpacity(0.1);
         $dw->composite($im2->getImageCompose(), 0, 0, 50, 0, $im2);
         $im1->drawImage($dw);
         if (!$im1->writeImage($path . '-s.png')) {
             echo '加水印失敗';
             exit;
         }
         $im1->clear();
         $im2->clear();
         $im1->destroy();
         $im2->destroy();
         //exit;
         //刪除相應的文件
         //unlink($path.'.svg');
         //unlink($path.'.png');
         $filepath = '/Uploads/' . date("Ymd", time()) . '/' . $savename . '.png';
         $data['origin_img'] = $filepath;
         $data['diy_synthetic_img'] = '/Uploads/' . date("Ymd", time()) . '/' . $savename . '-s.png';
         $data['diy_preview_img'] = '/Uploads/' . date("Ymd", time()) . '/' . $savename . '-s.png';
         $data['user_id'] = 0;
         $data['source'] = 3;
         $data['created'] = date("Y-m-d H:i:s", time());
         $datas['image'] = $data['diy_synthetic_img'];
         $datas['user_id'] = 0;
         $datas['source'] = 2;
         $datas['state'] = 1;
         $datas['createtime'] = date("Y-m-d H:i:s", time());
         $datas['updatetime'] = date("Y-m-d H:i:s", time());
         $diy_picture_id = $this->diy->adddiy($data);
         //$datas['use'] = $tool;
         //$datas['author'] = $userinfo['mobile'];
         $this->userpicture = new UserpictureModel();
         $datas['diy_picture_id'] = $diy_picture_id;
         $this->userpicture->adduserpicture($datas);
         $response_data['origin_img'] = '/Uploads/' . date("Ymd", time()) . '/' . $savename . '.png';
         $response_data['diy_preview_img'] = '/Uploads/' . date("Ymd", time()) . '/' . $savename . '-s.png';
         $response_data['diy_thumb_img'] = '/Uploads/' . date("Ymd", time()) . '/' . $savename . '-t.png';
         $response_data['diy_picture_id'] = $diy_picture_id;
         //$this->getView()->display("/index/buy.html",$response_data);
         $this->_session->set('diypicture', $response_data);
         $this->_redis = new phpredis();
         $this->_redis->set($diy_picture_id, json_encode($response_data));
         header("Location:/index/share?diy=" . $diy_picture_id);
     } else {
         switch ($id) {
             case 1:
                 $this->getView()->display("index/diy_1.html");
                 break;
             case 2:
                 $this->getView()->display("index/diy_2.html");
                 break;
             case 3:
                 $this->getView()->display("index/diy_3.html");
                 break;
//.........這裏部分代碼省略.........
開發者ID:qieangel2013,項目名稱:zys,代碼行數:101,代碼來源:Index.php


注:本文中的Imagick::setBackgroundColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。