• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP image_type_to_mime_type函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中image_type_to_mime_type函数的典型用法代码示例。如果您正苦于以下问题:PHP image_type_to_mime_type函数的具体用法?PHP image_type_to_mime_type怎么用?PHP image_type_to_mime_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了image_type_to_mime_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: upload

 /**
  * Upload an image.
  *
  * @param $file
  * @return array
  */
 public function upload(array $file)
 {
     if (!$file) {
         $status = ['status' => 'error', 'message' => GENERIC_UPLOAD_ERROR_MESSAGE];
         return $status;
     }
     $tempName = $file['tmp_name'];
     if (is_null($tempName)) {
         $status = ['status' => 'error', 'message' => GENERIC_UPLOAD_ERROR_MESSAGE];
         return $status;
     }
     $imageInfo = getimagesize($tempName);
     if (!$imageInfo) {
         $status = ['status' => 'error', 'message' => 'Only images are allowed'];
         return $status;
     }
     $fileType = image_type_to_mime_type(exif_imagetype($tempName));
     if (!in_array($fileType, $this->_allowedTypes)) {
         $status = ['status' => 'error', 'message' => 'File type not allowed'];
         return $status;
     }
     $fileName = htmlentities($file['name']);
     $height = $this->_imagick->getImageHeight();
     $width = $this->_imagick->getImageWidth();
     $uploadPath = $_SERVER['DOCUMENT_ROOT'] . PROPERTY_IMG_TMP_DIR;
     if (!move_uploaded_file($tempName, $uploadPath . "/{$fileName}")) {
         $status = ['status' => 'error', 'message' => 'Can\'t move file'];
         return $status;
     }
     $status = ['status' => 'success', 'url' => PROPERTY_IMG_TMP_DIR . '/' . $fileName, 'width' => $width, 'height' => $height, 'token' => $_SESSION['csrf_token']];
     return $status;
 }
开发者ID:justincdotme,项目名称:bookme,代码行数:38,代码来源:ImageUpload.php


示例2: generate

 /**
  * The hard stuff. Resizing an image while applying an appropriate background
  * @param $sourceImage
  * @param $targetImage
  * @param $targetWidth
  * @param $targetHeight
  * @param int $quality
  * @throws Exception
  */
 public static function generate($sourceImage, $targetImage, $targetWidth, $targetHeight, $quality = 100)
 {
     // get source dimensions
     list($sourceWidth, $sourceHeight, $sourceMimeType) = getimagesize($sourceImage);
     // resolving mime type e.g. image/*
     $imageType = image_type_to_mime_type($sourceMimeType);
     // resolve Image Resource handler against the said image type and the source image path
     $sourceImageResource = static::getImageResourceFromImageTypeAndFile($imageType, $sourceImage);
     // resolve aspect-ratio maintained height and width for the thumbnail against source's dimensions and expected
     // dimensions
     list($calculatedTargetWidth, $calculatedTargetHeight) = static::resolveNewWidthAndHeight($sourceWidth, $sourceHeight, $targetWidth, $targetHeight);
     // create an image with the aspect-ration maintained height and width, this will be used to resample the source
     // image
     $resampledImage = imagecreatetruecolor(round($calculatedTargetWidth), round($calculatedTargetHeight));
     imagecopyresampled($resampledImage, $sourceImageResource, 0, 0, 0, 0, $calculatedTargetWidth, $calculatedTargetHeight, $sourceWidth, $sourceHeight);
     // create an image of the thumbnail size we desire (this may be less than the aspect-ration maintained height
     // and width
     $targetImageResource = imagecreatetruecolor($targetWidth, $targetHeight);
     // setup a padding color, in our case we use white.
     $paddingColor = imagecolorallocate($targetImageResource, 255, 255, 255);
     // paint the target image all in the padding color so the canvas is completely white.
     imagefill($targetImageResource, 0, 0, $paddingColor);
     // now copy the resampled aspect-ratio maintained resized thumbnail onto the white canvas
     imagecopy($targetImageResource, $resampledImage, ($targetWidth - $calculatedTargetWidth) / 2, ($targetHeight - $calculatedTargetHeight) / 2, 0, 0, $calculatedTargetWidth, $calculatedTargetHeight);
     // save the resized thumbnail.
     if (!imagejpeg($targetImageResource, $targetImage, $quality)) {
         throw new Exception("Unable to save new image");
     }
 }
开发者ID:shoaibi,项目名称:image-parser,代码行数:38,代码来源:ThumbnailGenerator.php


示例3: output

 /**
  * Output the image to a browser
  */
 function output()
 {
     self::processImage();
     header('Content-Type: ' . image_type_to_mime_type($this->type));
     flush();
     imagejpeg($this->image, NULL, $this->quality);
 }
开发者ID:bodeman5,项目名称:WixDownloader,代码行数:10,代码来源:DynamicImageResizer.php


示例4: image_type_to_extension

 public function image_type_to_extension($imagetype)
 {
     if (empty($imagetype)) {
         return false;
     }
     switch ($imagetype) {
         case image_type_to_mime_type(IMAGETYPE_GIF):
             return 'gif';
         case image_type_to_mime_type(IMAGETYPE_JPEG):
             return 'jpg';
         case image_type_to_mime_type(IMAGETYPE_PNG):
             return 'png';
         case image_type_to_mime_type(IMAGETYPE_SWF):
             return 'swf';
         case image_type_to_mime_type(IMAGETYPE_PSD):
             return 'psd';
         case image_type_to_mime_type(IMAGETYPE_BMP):
             return 'bmp';
         case image_type_to_mime_type(IMAGETYPE_TIFF_II):
             return 'tiff';
         case image_type_to_mime_type(IMAGETYPE_TIFF_MM):
             return 'tiff';
         case 'image/pjpeg':
             return 'jpg';
         default:
             return false;
     }
 }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:28,代码来源:ImageFile.php


示例5: thumb

/**
* 生成缩略图函数
* @param $filename string 源文件
* @param $dst_w int 目标的宽,px
* @param $dst_h int 目标的高,px    默认都为一半
* @param $savepath string 保存路径
* @param $ifdelsrc boolean 是否删除源文件
* @return 缩略图文件名
*/
function thumb($filename, $dst_w = null, $dst_h = null, $savepath = null, $ifdelsrc = false)
{
    list($src_w, $src_h, $imagetype) = getimagesize($filename);
    $scale = 0.5;
    if (is_null($dst_w) || is_null($dst_h)) {
        $dst_w = ceil($src_w * $scale);
        $dst_h = ceil($src_h * $scale);
    }
    $mime = image_type_to_mime_type($imagetype);
    $createfunc = str_replace('/', 'createfrom', $mime);
    $outfunc = str_replace('/', null, $mime);
    $src_image = $createfunc($filename);
    $dst_image = imagecreatetruecolor($dst_w, $dst_h);
    imagecopyresampled($dst_image, $src_image, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);
    if (is_null($savepath)) {
        $savepath = $_SERVER['DOCUMENT_ROOT'] . 'images/thumb';
    }
    if (!empty($savepath) && !is_dir($savepath)) {
        mkdir($savepath, 0777, true);
    }
    $fileinfo = pathinfo($filename);
    $savename = uniqid() . '.' . $fileinfo['extension'];
    if (!empty($savepath)) {
        $outfunc($dst_image, $savepath . '/' . $savename);
    } else {
        $outfunc($dst_image, $savename);
    }
    imagedestroy($src_image);
    imagedestroy($dst_image);
    if (!$ifdelsrc) {
        unlink($filename);
    }
    return $savename;
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:43,代码来源:thumb_func.php


示例6: thumb

/**
 * 生成缩略图
 * @param string $filename
 * @param string $destination
 * @param int $dst_w
 * @param int $dst_h
 * @param bool $isReservedSource
 * @param number $scale
 * @return string
 */
function thumb($filename, $destination = null, $dst_w, $dst_h = NULL, $isReservedSource = true)
{
    list($src_w, $src_h, $imagetype) = getimagesize($filename);
    if ($src_w <= $dst_w) {
        $dst_w = $src_w;
        $dst_h = $src_h;
    }
    if (is_null($dst_h)) {
        $dst_h = scaling($src_w, $src_h, $dst_w);
    }
    $mime = image_type_to_mime_type($imagetype);
    $createFun = str_replace("/", "createfrom", $mime);
    $outFun = str_replace("/", null, $mime);
    $src_image = $createFun($filename);
    $dst_image = imagecreatetruecolor($dst_w, $dst_h);
    imagecopyresampled($dst_image, $src_image, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);
    if ($destination && !file_exists(dirname($destination))) {
        mkdir(dirname($destination), 0777, true);
    }
    $dstFilename = $destination == null ? getUniName() . "." . getExt($filename) : $destination;
    $outFun($dst_image, $dstFilename);
    imagedestroy($src_image);
    imagedestroy($dst_image);
    if (!$isReservedSource) {
        unlink($filename);
    }
    return $dstFilename;
}
开发者ID:hardihuang,项目名称:happyhome_admin,代码行数:38,代码来源:image.func.php


示例7: getImageFromUrl

 public static function getImageFromUrl($image_url)
 {
     try {
         $mime = image_type_to_mime_type(exif_imagetype($image_url));
     } catch (Exception $e) {
         throw new MimeTypeException($e->getMessage());
     }
     //Get image based on mime and set to $im
     switch ($mime) {
         case 'image/jpeg':
             $im = imagecreatefromjpeg($image_url);
             break;
         case 'image/gif':
             $im = imagecreatefromgif($image_url);
             break;
         case 'image/png':
             $im = imagecreatefrompng($image_url);
             break;
         case 'image/wbmp':
             $im = imagecreatefromwbmp($image_url);
             break;
         default:
             throw new MimeTypeException("An image of '{$mime}' mime type is not supported.");
             break;
     }
     return $im;
 }
开发者ID:aaronbullard,项目名称:litmus,代码行数:27,代码来源:LitmusService.php


示例8: fileupload_trigger_check

 function fileupload_trigger_check()
 {
     if (intval(get_query_var('postform_fileupload')) == 1) {
         if (!(get_option('bbp_5o1_toolbar_allow_image_uploads') && (is_user_logged_in() || get_option('bbp_5o1_toolbar_allow_anonymous_image_uploads')))) {
             echo htmlspecialchars(json_encode(array("error" => __("You are not permitted to upload images.", 'bbp_5o1_toolbar'))), ENT_NOQUOTES);
             exit;
         }
         require_once dirname(__FILE__) . '/includes/fileuploader.php';
         // list of valid extensions, ex. array("jpeg", "xml", "bmp")
         $allowedExtensions = array('jpg', 'jpeg', 'png', 'gif');
         // Because using Extensions only is very bad.
         $allowedMimes = array(IMAGETYPE_JPEG, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_GIF);
         // max file size in bytes
         $sizeLimit = bbp_5o1_images_panel::return_bytes(min(array(ini_get('post_max_size'), ini_get('upload_max_filesize'))));
         $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
         $directory = wp_upload_dir();
         $result = $uploader->handleUpload(trailingslashit($directory['path']));
         $mime = exif_imagetype($result['file']);
         if (!$mime || !in_array($mime, $allowedMimes)) {
             $deleted = unlink($result['file']);
             echo htmlspecialchars(json_encode(array("error" => __("Disallowed file type.", 'bbp_5o1_toolbar'))), ENT_NOQUOTES);
             exit;
         }
         // Construct the attachment array
         $attachment = array('post_mime_type' => $mime ? image_type_to_mime_type($mime) : '', 'guid' => trailingslashit($directory['url']) . $result['filename'], 'post_parent' => 0, 'post_title' => $result['name'], 'post_content' => 'Image uploaded for a forum topic or reply.');
         // Save the data
         $id = wp_insert_attachment($attachment, $result['file'], 0);
         $result['id'] = $id;
         $result['attachment'] = $attachment;
         $result = array("success" => true, "file" => $attachment['guid']);
         echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
         exit;
     }
 }
开发者ID:sayf75,项目名称:bbPress-Post-Toolbar,代码行数:34,代码来源:toolbar-images-panel.php


示例9: actionShow

 public function actionShow()
 {
     $nome_da_pasta = $_GET['path'];
     $arquivo = $_GET['file'];
     $largura = $_GET['width'];
     $path = Yii::app()->fileManager->findFile($arquivo, $nome_da_pasta, $largura);
     if (!is_null($path)) {
         $info = getimagesize($path);
         $mime = image_type_to_mime_type($info[2]);
         switch ($mime) {
             case "image/jpeg":
                 $image = imagecreatefromjpeg($path);
                 header("Content-Type: image/jpeg");
                 imagejpeg($image);
                 break;
             case "image/png":
                 $image = imagecreatefrompng($path);
                 header("Content-Type: image/png");
                 imagepng($image);
                 break;
             case "image/gif":
                 $image = imagecreatefromgif($path);
                 header("Content-Type: image/gif");
                 imagegif($image);
                 break;
         }
     }
 }
开发者ID:habibu,项目名称:YiiCommerce,代码行数:28,代码来源:ImagemController.php


示例10: thumb

function thumb($filename, $destination = null, $dst_w = null, $dst_h = null, $isReservedSource = false, $scale = 0.5)
{
    list($src_w, $src_h, $imagetype) = getimagesize($filename);
    if (is_null($dst_w) || is_null($dst_h)) {
        $dst_w = ceil($src_w * $scale);
        $dst_h = ceil($src_h * $scale);
    }
    $mime = image_type_to_mime_type($imagetype);
    $createFun = str_replace("/", "createfrom", $mime);
    $outFun = str_replace("/", null, $mime);
    $src_image = $createFun($filename);
    $dst_image = imagecreatetruecolor($dst_w, $dst_h);
    imagecopyresampled($dst_image, $src_image, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);
    //image_50/sdfsdkfjkelwkerjle.jpg
    if ($destination && !file_exists(dirname($destination))) {
        mkdir(dirname($destination), 0777, true);
    }
    $dstFilename = $destination == null ? getUniName() . "." . getExt($filename) : $destination;
    $outFun($dst_image, $dstFilename);
    imagedestroy($src_image);
    imagedestroy($dst_image);
    if (!$isReservedSource) {
        unlink($filename);
    }
    return $dstFilename;
}
开发者ID:Wumingla,项目名称:shopImooc,代码行数:26,代码来源:resizeImage2.php


示例11: ReSize

 /**
  *  Resize an image to the specified dimensions, placing the resulting
  *  image in the specified location.  At least one of $newWidth or
  *  $newHeight must be specified.
  *
  *  @param  string  $type       Either 'thumb' or 'disp'
  *  @param  integer $newWidth   New width, in pixels
  *  @param  integer $newHeight  New height, in pixels
  *  @return string  Blank if successful, error message otherwise.
  */
 public static function ReSize($src, $dst, $newWidth = 0, $newHeight = 0)
 {
     global $_LGLIB_CONF;
     // Calculate the new dimensions
     $A = self::reDim($src, $newWidth, $newHeight);
     if ($A === false) {
         COM_errorLog("Invalid image {$src}");
         return 'invalid image conversion';
     }
     list($sWidth, $sHeight, $dWidth, $dHeight) = $A;
     // Get the mime type for the glFusion resizing functions
     $mime_type = image_type_to_mime_type(exif_imagetype($src));
     // Returns an array, with [0] either true/false and [1]
     // containing a message.
     $result = array();
     if (function_exists(_img_resizeImage)) {
         $result = _img_resizeImage($src, $dst, $sHeight, $sWidth, $dHeight, $dWidth, $mime_type);
     } else {
         $result[0] = false;
     }
     if ($result[0] == true) {
         return '';
     } else {
         COM_errorLog("Failed to convert {$src} ({$sHeight} x {$sWidth}) to {$dst} ({$dHeight} x {$dWidth})");
         return 'invalid image conversion';
     }
 }
开发者ID:NewRoute,项目名称:lglib,代码行数:37,代码来源:image.class.php


示例12: upload

 public function upload()
 {
     if ($this->entityName === null || $this->entityId === null) {
         throw new \Exception('property entityName and entityId must be set to other than null');
     }
     $dir = $this->dir();
     if (!file_exists($dir)) {
         return false;
     }
     $path = $this->path();
     $tmp = $this->uploadData['tmp_name'];
     $check = getimagesize($tmp);
     if ($check === false) {
         return false;
     }
     switch ($check['mime']) {
         case image_type_to_mime_type(IMAGETYPE_GIF):
         case image_type_to_mime_type(IMAGETYPE_PNG):
         case image_type_to_mime_type(IMAGETYPE_JPEG):
             break;
         default:
             return false;
     }
     if (move_uploaded_file($tmp, $path)) {
         $this->thumbnail();
         return true;
     }
     return false;
 }
开发者ID:Koohiisan,项目名称:Enpowi,代码行数:29,代码来源:EntityImage.php


示例13: resizeThumbnailImage

function resizeThumbnailImage($thumb_image_name, $image, $width, $height, $start_width, $start_height, $scale)
{
    list($imagewidth, $imageheight, $imageType) = getimagesize($image);
    $imageType = image_type_to_mime_type($imageType);
    $newImageWidth = ceil($width * $scale);
    $newImageHeight = ceil($height * $scale);
    $newImage = imagecreatetruecolor($newImageWidth, $newImageHeight);
    switch ($imageType) {
        case "image/png":
        case "image/x-png":
            $source = imagecreatefrompng($image);
            break;
    }
    imagecopyresampled($newImage, $source, 0, 0, $start_width, $start_height, $newImageWidth, $newImageHeight, $width, $height);
    switch ($imageType) {
        case "image/png":
        case "image/x-png":
            $transcol = imagecolorallocatealpha($newImage, 255, 0, 255, 127);
            $trans = imagecolortransparent($newImage, $transcol);
            imagefill($newImage, 0, 0, $transcol);
            imagesavealpha($newImage, true);
            imagealphablending($newImage, true);
            imagepng($newImage, $thumb_image_name);
            break;
    }
    chmod($thumb_image_name, 0777);
}
开发者ID:kershan,项目名称:Crysandrea,代码行数:27,代码来源:avatar_helper.php


示例14: getImage

 protected function getImage($image_url)
 {
     $this->url = $image_url;
     $mime = image_type_to_mime_type(exif_imagetype($image_url));
     $im;
     //Get image based on mime and set to $im
     switch ($mime) {
         case 'image/jpeg':
             $im = imagecreatefromjpeg($image_url);
             break;
         case 'image/gif':
             $im = imagecreatefromgif($image_url);
             break;
         case 'image/png':
             $im = imagecreatefrompng($image_url);
             break;
         case 'image/wbmp':
             $im = imagecreatefromwbmp($image_url);
             break;
         default:
             return NULL;
             break;
     }
     $this->image = $im;
     return $this;
 }
开发者ID:aaronbullard,项目名称:litmus,代码行数:26,代码来源:RemoteImage.php


示例15: action_preview2

 public function action_preview2()
 {
     $dir = $this->uploads_dir();
     // build image file name
     $filename = $this->request->param('filename');
     // check if file exists
     if (!file_exists($filename) or !is_file($filename)) {
         throw new HTTP_Exception_404('Picture not found');
     }
     $cachenamearr = explode('/', $filename);
     $name = array_pop($cachenamearr);
     $cachename = 'a2' . $name;
     $cachename = str_replace($name, $cachename, $filename);
     /** @var Image $image **/
     // trying get picture preview from cache
     if (($image = Cache::instance()->get($cachename)) === NULL) {
         // create new picture preview
         $image = Image::factory($filename)->resize(null, 50)->crop(50, 50)->render(NULL, 90);
         // store picture in cache
         Cache::instance()->set($cachename, $image, Date::MONTH);
     }
     // gets image type
     $info = getimagesize($filename);
     $mime = image_type_to_mime_type($info[2]);
     // display image
     $this->response->headers('Content-type', $mime);
     $this->response->body($image);
 }
开发者ID:chernogolov,项目名称:blank,代码行数:28,代码来源:Show.php


示例16: createImage

/**
 * 生成缩略图
 * @param string $imageName
 * @param float $scale
 */
function createImage($imageName, $scale = 0.5)
{
    print_r(getimagesize($imageName));
    //获取原始图片的宽度、高度、类型(数字)
    list($src_w, $src_h, $src_type) = getimagesize($imageName);
    //获取mime
    $mime = image_type_to_mime_type($src_type);
    echo $mime;
    $createFunc = str_replace("/", "createfrom", $mime);
    //imagecreatefromjpeg函数
    $outFunc = str_replace("/", null, $mime);
    //imagejpeg函数
    //读取源图片(使用变量函数)
    //$src_img = $createFunc($imageName);
    //使用变量函数
    $src_img = call_user_func($createFunc, $imageName);
    $dst_w = $scale * $src_w;
    $dst_h = $scale * $src_h;
    //创建目标图片
    $dst_img = imagecreatetruecolor($dst_w, $dst_h);
    //复制图片
    imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);
    //输出图片
    //$outFunc($dst_img, "small/" . $imageName);
    call_user_func($outFunc, $dst_img, "small/" . $imageName);
    //释放资源
    imagedestroy($src_img);
    imagedestroy($dst_img);
}
开发者ID:yangchenglong,项目名称:myshop,代码行数:34,代码来源:image.php


示例17: __construct

 /**
  * Constructor. Opens an image.
  * @param string $filename File path
  * @param boolean $throwErrors [optional] If true will be throws exceptions
  * @throws InvalidParamException
  */
 public function __construct($filename, $throwErrors = true)
 {
     $filename = Yii::getAlias($filename);
     if (!is_readable($filename)) {
         $this->error = sprintf('Enable to read file: "%s"', $filename);
         if ($throwErrors) {
             throw new InvalidParamException($this->error);
         }
         return;
     }
     try {
         $info = getimagesize($filename);
     } catch (\Exception $e) {
         // Ignore
     }
     if (empty($info) || empty($info[0]) || empty($info[1])) {
         $this->error = sprintf('Bad image format: "%s"', $filename);
         if ($throwErrors) {
             throw new InvalidParamException($this->error);
         }
         return;
     }
     $this->filename = $filename;
     $this->width = intval($info[0]);
     $this->height = intval($info[1]);
     $this->type = $info[2];
     $this->mime = image_type_to_mime_type($this->type);
 }
开发者ID:heartshare,项目名称:yii2-image-5,代码行数:34,代码来源:Driver.php


示例18: jeg_get_image_meta

/**
 * Get image meta description for image ( basedir , baseurl , imgpath , extension , height , width , destpath , imagetype)
 * 
 * @param string $source URL source of image
 * @return array of image meta description 
 */
function jeg_get_image_meta($source)
{
    // meta image container
    $meta = array();
    // define upload path & dir
    $upload_info = wp_upload_dir();
    $meta['basedir'] = $upload_info['basedir'];
    $meta['baseurl'] = $upload_info['baseurl'];
    // check if image is local
    if (strpos($source, $meta['baseurl']) === false) {
        return false;
    } else {
        $destpath = str_replace($meta['baseurl'], '', $source);
        $meta['imgpath'] = $meta['basedir'] . $destpath;
        // check if img path exists, and is an image indeed
        if (!file_exists($meta['imgpath']) or !getimagesize($meta['imgpath'])) {
            return false;
        } else {
            // get image info
            $info = pathinfo($meta['imgpath']);
            $meta['extension'] = $info['extension'];
            // get image size
            $imagesize = getimagesize($meta['imgpath']);
            $meta['width'] = $imagesize[0];
            $meta['height'] = $imagesize[1];
            $meta['imagetype'] = image_type_to_mime_type($imagesize[2]);
            // now define dest path
            $meta['destpath'] = str_replace('.' . $meta['extension'], '', $destpath);
            // return this meta
            return $meta;
        }
    }
}
开发者ID:OpenDoorBrewCo,项目名称:odbc-wp-prod,代码行数:39,代码来源:init-image.php


示例19: __construct

 /**
  * @uses FileExtension
  */
 public function __construct($file, $do_exit = true)
 {
     list($width, $height, $mime_type, $attr) = getimagesize($file);
     if (!is_string($mime_type)) {
         $extension = new FileExtension($file);
         switch ($extension->__toString()) {
             case 'jpg':
             case 'jpeg':
                 $image_type = \IMAGETYPE_JPEG;
                 break;
             case 'gif':
                 $image_type = \IMAGETYPE_GIF;
                 break;
             case 'png':
                 $image_type = \IMAGETYPE_PNG;
                 break;
             default:
                 throw new \Exception("Could not determine image type from filename");
                 break;
         }
         $mime_type = image_type_to_mime_type($image_type);
     }
     header("Content-type: " . $mime_type);
     readfile($file);
     if ($do_exit) {
         exit;
     }
 }
开发者ID:tomkyle,项目名称:yaphr,代码行数:31,代码来源:DeliverImage.php


示例20: imageTypeToMimeType

 /**
  * Get the mime type as a string by passing the Image type as corresponding to one of the static 
  * class variables of the Image class
  */
 function imageTypeToMimeType($type)
 {
     if (function_exists('image_type_to_mime_type')) {
         $ret = image_type_to_mime_type($type);
     }
     return $ret;
 }
开发者ID:k7n4n5t3w4rt,项目名称:SeeingSystem,代码行数:11,代码来源:image_utility.class.php



注:本文中的image_type_to_mime_type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP image_url函数代码示例发布时间:2022-05-15
下一篇:
PHP image_type_to_extension函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap