当前位置: 首页>>代码示例>>PHP>>正文


PHP imagetypes函数代码示例

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


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

示例1: scissors_supports_imagetype

 function scissors_supports_imagetype($mime_type)
 {
     if (function_exists('imagetypes')) {
         switch ($mime_type) {
             case 'image/jpeg':
                 return (imagetypes() & IMG_JPG) != 0;
             case 'image/png':
                 return (imagetypes() & IMG_PNG) != 0;
             case 'image/gif':
                 return (imagetypes() & IMG_GIF) != 0;
             default:
                 return FALSE;
         }
     } else {
         switch ($mime_type) {
             case 'image/jpeg':
                 return function_exists('imagecreatefromjpeg');
             case 'image/png':
                 return function_exists('imagecreatefrompng');
             case 'image/gif':
                 return function_exists('imagecreatefromgif');
             default:
                 return FALSE;
         }
     }
 }
开发者ID:gopi158,项目名称:Sample,代码行数:26,代码来源:scissors.php

示例2: check_php

function check_php()
{
    $data = array();
    $data['errors'] = array();
    $data['caninstall'] = true;
    $ver = explode('.', PHP_VERSION);
    $ver_num = $ver[0] . $ver[1] . $ver[2];
    if ($ver_num < 500) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_version', 'message' => 'Votre version de PHP est trop vieille. Installez PHP 5.');
    } elseif ($ver_num < 529) {
        $data['errors'][] = array('level' => 'warning', 'code' => 'php_version', 'message' => 'Vous utilisez PHP ' . PHP_VERSION . ' !<br />Il est conseill&eacute; d\'utiliser au moins la version 5.2.9 de PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_version', 'message' => 'Votre version de PHP (' . PHP_VERSION . ') est support&eacute;e par Iconito.');
    }
    if (ini_get('session.auto_start')) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'session_autostart', 'message' => 'Vous devez d&eacute;sactiver la cr&eacute;ation de session automatique. Pour cela, modifiez la directive "session.auto_start" dans votre php.ini (pour tous vos sites), dans la configuration de votre virtualhost dans la configuration d\'Apache (pour ce site sp&eacute;cifiquement), ou dans le .htaccess d\'Iconito (dans le r&eacute;pertoire "Iconito/www").');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'session_autostart', 'message' => 'La cr&eacute;ation de session automatique est d&eacute;sactiv&eacute;e.');
    }
    $php_extensions = get_loaded_extensions();
    if (!in_array('xml', $php_extensions)) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_ext_xml', 'message' => 'Vous devez activer l\'extension "xml" dans PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_ext_xml', 'message' => 'L\'extension "xml" est activ&eacute;e.');
    }
    if (!in_array('session', $php_extensions)) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_ext_session', 'message' => 'Vous devez activer l\'extension "session" dans PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_ext_session', 'message' => 'L\'extension "session" est activ&eacute;e.');
    }
    if (!in_array('mysql', $php_extensions)) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_ext_mysql', 'message' => 'Vous devez activer l\'extension "mysql" dans PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_ext_mysql', 'message' => 'L\'extension "mysql" est activ&eacute;e.');
    }
    if (!in_array('gd', $php_extensions)) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_ext_gd', 'message' => 'Vous devez activer l\'extension "gd" dans PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_ext_gd', 'message' => 'L\'extension "gd" est activ&eacute;e.');
        if (!(imagetypes() & IMG_GIF)) {
            $data['caninstall'] = true;
            $data['errors'][] = array('level' => 'warning', 'code' => 'php_gd_gif', 'message' => 'Votre version de "gd" ne supporte pas l\'&eacute;criture du format GIF. Il est pr&eacute;f&eacute;rable de mettre &agrave; jour cette extension.');
        } else {
            $data['errors'][] = array('level' => 'good', 'code' => 'php_gd_gif', 'message' => 'Votre version de "gd" supporte le format GIF.');
        }
    }
    if (!in_array('zlib', $php_extensions)) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_ext_zlib', 'message' => 'Vous devez activer l\'extension "zlib" dans PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_ext_zlib', 'message' => 'L\'extension "zlib" est activ&eacute;e.');
    }
    return $data;
}
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:60,代码来源:install_check.class.php

示例3: get_supported_image_types

/**
* Get supported image types
*/
function get_supported_image_types($type)
{
    if (@extension_loaded('gd')) {
        $format = imagetypes();
        $new_type = 0;
        switch ($type) {
            case 1:
                $new_type = $format & IMG_GIF ? IMG_GIF : 0;
                break;
            case 2:
            case 9:
            case 10:
            case 11:
            case 12:
                $new_type = $format & IMG_JPG ? IMG_JPG : 0;
                break;
            case 3:
                $new_type = $format & IMG_PNG ? IMG_PNG : 0;
                break;
            case 6:
            case 15:
                $new_type = $format & IMG_WBMP ? IMG_WBMP : 0;
                break;
        }
        return array('gd' => $new_type ? true : false, 'format' => $new_type, 'version' => function_exists('imagecreatetruecolor') ? 2 : 1);
    }
    return array('gd' => false);
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:31,代码来源:functions_thumbs.php

示例4: saveImage

 /**
  * Save the image as the image type the original image was
  *
  * @param  string $savePath     - The path to store the new image
  * @param  string $imageQuality - The qulaity level of image to create
  *
  * @param bool    $download
  *
  * @return null Saves the image
  */
 public function saveImage($savePath, $imageQuality = "100", $download = false)
 {
     if (!$this->newImage) {
         return;
     }
     switch ($this->ext) {
         case 'image/jpg':
         case 'image/jpeg':
             // Check PHP supports this file type
             if (imagetypes() & IMG_JPG) {
                 imagejpeg($this->newImage, $savePath, $imageQuality);
             }
             break;
         case 'image/gif':
             // Check PHP supports this file type
             if (imagetypes() & IMG_GIF) {
                 imagegif($this->newImage, $savePath);
             }
             break;
         case 'image/png':
             $invertScaleQuality = 9 - round($imageQuality / 100 * 9);
             // Check PHP supports this file type
             if (imagetypes() & IMG_PNG) {
                 imagepng($this->newImage, $savePath, $invertScaleQuality);
             }
             break;
     }
     if ($download) {
         header('Content-Description: File Transfer');
         header("Content-type: application/octet-stream");
         header("Content-disposition: attachment; filename= " . $savePath . "");
         readfile($savePath);
     }
     imagedestroy($this->newImage);
 }
开发者ID:linestorm,项目名称:media-bundle,代码行数:45,代码来源:ImageResize.php

示例5: welcome

 public function welcome()
 {
     /* 系统信息 */
     $conn = mysql_connect(C('DB_HOST'), C('DB_USER'), C('DB_PWD'));
     $gd = gd_version();
     $sys_info['os'] = PHP_OS;
     $sys_info['ip'] = $_SERVER['SERVER_ADDR'];
     $sys_info['web_server'] = $_SERVER['SERVER_SOFTWARE'];
     $sys_info['php_ver'] = PHP_VERSION;
     $sys_info['mysql_ver'] = mysql_get_server_info($conn);
     $sys_info['zlib'] = function_exists('gzclose') ? L('yes') : L('no');
     $sys_info['safe_mode'] = (boolean) ini_get('safe_mode') ? L('yes') : L('no');
     $sys_info['safe_mode_gid'] = (boolean) ini_get('safe_mode_gid') ? L('yes') : L('no');
     $sys_info['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : L('no_timezone');
     $sys_info['socket'] = function_exists('fsockopen') ? L('yes') : L('no');
     
     if ($gd == 0) {
         $sys_info['gd'] = 'N/A';
     } else {
         if ($gd == 1) {
             $sys_info['gd'] = 'GD1';
         } else {
             $sys_info['gd'] = 'GD2';
         }
         
         $sys_info['gd'] .= ' (';
         
         /* 检查系统支持的图片类型 */
         if ($gd && (imagetypes() & IMG_JPG) > 0) {
             $sys_info['gd'] .= ' JPEG';
         }
         
         if ($gd && (imagetypes() & IMG_GIF) > 0) {
             $sys_info['gd'] .= ' GIF';
         }
         
         if ($gd && (imagetypes() & IMG_PNG) > 0) {
             $sys_info['gd'] .= ' PNG';
         }
         
         $sys_info['gd'] .= ')';
     }
     
     /* IP库版本 */
     $sys_info['ip_version'] = ecs_geoip('255.255.255.0');
     
     /* 允许上传的最大文件大小 */
     $sys_info['max_filesize'] = ini_get('upload_max_filesize');
     $this->assign('sys_info', $sys_info);
     
     $this->assign('ecs_version', VERSION);
     $this->assign('ecs_release', RELEASE);
     $this->assign('ecs_charset', strtoupper(EC_CHARSET));
     $this->assign('install_date', local_date(C('date_format'), C('install_date')));
     // 检测是否授权
     $data = array('appid' => ECTOUCH_AUTH_KEY);
     $empower = $this->cloud->data($data)->act('get.license');
     $this->assign('empower', $empower);
     $this->display('welcome');
 }
开发者ID:sayi21cn,项目名称:ecshopAndEctouch,代码行数:60,代码来源:IndexController.class.php

示例6: Jaws_Image_GD

 /**
  * Constructor
  *
  * @access  public
  * @return  mixed   True on success or Jaws_Error on failure
  */
 function Jaws_Image_GD()
 {
     if (!extension_loaded('gd')) {
         return Jaws_Error::raiseError('GD library is not available.', __FUNCTION__);
     }
     $types = imagetypes();
     if ($types & IMG_PNG) {
         $this->_supported_image_types['png'] = 'rw';
     }
     if ($types & IMG_GIF || function_exists('imagegif') || function_exists('imagecreatefromgif')) {
         $this->_supported_image_types['gif'] = 'rw';
     }
     if ($types & IMG_JPG) {
         $this->_supported_image_types['jpeg'] = 'rw';
     }
     if ($types & IMG_WBMP) {
         $this->_supported_image_types['wbmp'] = 'rw';
     }
     if ($types & IMG_XPM) {
         $this->_supported_image_types['xpm'] = 'r';
     }
     if (empty($this->_supported_image_types)) {
         return Jaws_Error::raiseError('No supported image types available.', __FUNCTION__);
     }
     return true;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:32,代码来源:GD.php

示例7: gerar_tumbs_real

function gerar_tumbs_real($t_x, $t_y, $qualidade, $c_original, $c_final)
{
    $thumbnail = imagecreatetruecolor($t_x, $t_y);
    $original = $c_original;
    $igInfo = getImageSize($c_original);
    switch ($igInfo['mime']) {
        case 'image/gif':
            if (imagetypes() & IMG_GIF) {
                $originalimage = imageCreateFromGIF($original);
            } else {
                $ermsg = MSG_GIF_NOT_COMPATIBLE . '<br />';
            }
            break;
        case 'image/jpeg':
            if (imagetypes() & IMG_JPG) {
                $originalimage = imageCreateFromJPEG($original);
            } else {
                $ermsg = MSG_JPG_NOT_COMPATIBLE . '<br />';
            }
            break;
        case 'image/png':
            if (imagetypes() & IMG_PNG) {
                $originalimage = imageCreateFromPNG($original);
            } else {
                $ermsg = MSG_PNG_NOT_COMPATIBLE . '<br />';
            }
            break;
        case 'image/wbmp':
            if (imagetypes() & IMG_WBMP) {
                $originalimage = imageCreateFromWBMP($original);
            } else {
                $ermsg = MSG_WBMP_NOT_COMPATIBLE . '<br />';
            }
            break;
        default:
            $ermsg = $igInfo['mime'] . MSG_FORMAT_NOT_COMPATIBLE . '<br />';
            break;
    }
    $nLargura = $igInfo[0];
    $nAltura = $igInfo[1];
    if ($nLargura > $t_x and $nAltura > $t_y) {
        if ($t_x <= $t_y) {
            $nLargura = (int) ($igInfo[0] * $t_y / $igInfo[1]);
            $nAltura = $t_y;
        } else {
            $nLargura = $t_x;
            $nAltura = (int) ($igInfo[1] * $t_x / $igInfo[0]);
            if ($nAltura < $t_y) {
                $nLargura = (int) ($igInfo[0] * $t_y / $igInfo[1]);
                $nAltura = $t_y;
            }
        }
    }
    $x_pos = $t_x / 2 - $nLargura / 2;
    $y_pos = $t_y / 2 - $nAltura / 2;
    imagecopyresampled($thumbnail, $originalimage, $x_pos, $y_pos, 0, 0, $nLargura, $nAltura, $igInfo[0], $igInfo[1]);
    imagejpeg($thumbnail, $c_final, $qualidade);
    imagedestroy($thumbnail);
    return 'ok';
}
开发者ID:amorimlima,项目名称:Hospital,代码行数:60,代码来源:Thumbs.php

示例8: hasGDSupport

    public static function hasGDSupport() {
      if ( imagetypes() & ( IMG_JPG || IMG_GIF || IMG_PNG ) ) {
        return true;
      }

      return false;
    }
开发者ID:haraldpdl,项目名称:oscommerce,代码行数:7,代码来源:Image.php

示例9: run

 public function run($file)
 {
     $res = $this->open_image($file);
     if ($res != TRUE) {
         return FALSE;
     }
     $this->image_progressive = isset($this->settings['field_settings']['progressive_jpeg']) === TRUE && $this->settings['field_settings']['progressive_jpeg'] == 'yes' ? TRUE : FALSE;
     $width = $this->EE->channel_images->image_dim['width'];
     $height = $this->EE->channel_images->image_dim['height'];
     $imgdest = imagecreatetruecolor($width, $height);
     if (imagetypes() & IMG_PNG) {
         imagesavealpha($imgdest, true);
         imagealphablending($imgdest, false);
     }
     for ($x = 0; $x < $width; $x++) {
         for ($y = 0; $y < $height; $y++) {
             if ($this->settings['axis'] == 'both') {
                 imagecopy($imgdest, $this->EE->channel_images->image, $width - $x - 1, $height - $y - 1, $x, $y, 1, 1);
             } else {
                 if ($this->settings['axis'] == 'horizontal') {
                     imagecopy($imgdest, $this->EE->channel_images->image, $width - $x - 1, $y, $x, $y, 1, 1);
                 } else {
                     if ($this->settings['axis'] == 'vertical') {
                         imagecopy($imgdest, $this->EE->channel_images->image, $x, $height - $y - 1, $x, $y, 1, 1);
                     }
                 }
             }
         }
     }
     $this->EE->channel_images->image = $imgdest;
     $this->save_image($file);
     return TRUE;
 }
开发者ID:ayuinc,项目名称:laboratoria-v2,代码行数:33,代码来源:action.flip.php

示例10: run

 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;
 }
开发者ID:ayuinc,项目名称:laboratoria-v2,代码行数:59,代码来源:action.rotate.php

示例11: create

 public function create()
 {
     //набор символов
     $letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'q', 'j', 'k', 'm', 'n', 'p', 'z', 'x', 'y', 's', 'u', 't', '2', '4', '5', '6', '7', '8', '9', '%', '+', '@', '#', '=', '?');
     //цвета
     $colors = array('90', '110', '130', '150', '170', '190', '210');
     $src = imagecreatetruecolor($this->width, $this->height);
     //создаем изображение
     $fon = imagecolorallocate($src, 255, 255, 255);
     //создаем фон
     imagefill($src, 0, 0, $fon);
     //заливаем изображение фоном
     for ($i = 0; $i < $this->fon_let_amount; $i++) {
         //случайный цвет
         $color = imagecolorallocatealpha($src, rand(0, 255), rand(0, 255), rand(0, 255), 100);
         //случайный символ
         $letter = $letters[rand(0, sizeof($letters) - 1)];
         //случайный размер
         $size = rand($this->font_size - 2, $this->font_size + 2);
         imagettftext($src, $size, rand(0, 45), rand($this->width * 0.1, $this->width - $this->width * 0.1), rand($this->height * 0.2, $this->height), $color, $this->font, $letter);
     }
     $code = array();
     for ($i = 0; $i < $this->let_amount; $i++) {
         $color = imagecolorallocatealpha($src, $colors[rand(0, sizeof($colors) - 1)], $colors[rand(0, sizeof($colors) - 1)], $colors[rand(0, sizeof($colors) - 1)], rand(20, 40));
         $letter = $letters[rand(0, sizeof($letters) - 1)];
         $size = rand($this->font_size * 2 - 2, $this->font_size * 2 + 2);
         $x = ($i + 1) * $this->font_size + rand(1, 5);
         //даем каждому символу случайное смещение
         $y = $this->height * 2 / 3 + rand(0, 5);
         $code[] = $letter;
         //запоминаем код
         imagettftext($src, $size, rand(0, 15), $x, $y, $color, $this->font, $letter);
     }
     $code = implode('', $code);
     //переводим код в строку
     // Обработка вывода
     if (imagetypes() & IMG_JPG) {
         // для JPEG
         header('Content-Type: image/jpeg');
         imagejpeg($src, NULL, 100);
     } elseif (imagetypes() & IMG_PNG) {
         // для PNG
         header('Content-Type: image/png');
         imagepng($src);
     } elseif (imagetypes() & IMG_GIF) {
         // для GIF
         header('Content-Type: image/gif');
         imagegif($src);
     } elseif (imagetypes() & IMG_PNG) {
         // для WBMP
         header('Content-Type: image/vnd.wap.wbmp');
         imagewbmp($src);
     } else {
         imagedestroy($src);
         return;
     }
     Session::set_server_data(array('captcha' => $code));
 }
开发者ID:viking2000,项目名称:web-antarix,代码行数:58,代码来源:captcha.php

示例12: __construct

 /**
  * Constructor of Image handler
  *
  * @param string $file Path to the file
  * @param array $config Configure array
  */
 public function __construct($file, array &$config = array())
 {
     $this->setting = $config;
     $this->setting['SupportedImageTypes'] = imagetypes();
     if ($image = $this->openImage($file)) {
         $this->imageRes = $image['Res'];
         $this->imageInfo = $image['Info'];
     }
 }
开发者ID:raincious,项目名称:facula,代码行数:15,代码来源:GD.php

示例13: ReadSourceFile

 function ReadSourceFile($image_file_name)
 {
     $this->DestroyImage();
     $this->ImageStatsSRC = @getimagesize($image_file_name);
     if ($this->ImageStatsSRC[2] == 3) {
         $this->ImageStatsSRC[2] = IMG_PNG;
     }
     $this->ImageMimeType = $this->ImageStatsSRC['mime'];
     $this->ImageTypeNo = $this->ImageStatsSRC[2];
     switch ($this->ImageTypeNo) {
         case IMG_GIF:
             if (!(imagetypes() & $this->ImageTypeNo)) {
                 return false;
             }
             $this->ImageTypeExt = '.gif';
             $image_read_func = 'imagecreatefromgif';
             break;
         case IMG_JPG:
             if (!(imagetypes() & $this->ImageTypeNo)) {
                 return false;
             }
             if (function_exists('exif_read_data')) {
                 $this->exif_get_data($image_file_name);
             }
             $this->ImageTypeExt = '.jpg';
             $image_read_func = 'imagecreatefromjpeg';
             break;
         case IMG_PNG:
             if (!(imagetypes() & $this->ImageTypeNo)) {
                 return false;
             }
             $this->ImageTypeExt = '.png';
             $image_read_func = 'imagecreatefrompng';
             break;
         default:
             return false;
     }
     $this->ImageID = $image_read_func($image_file_name);
     if (function_exists('imageistruecolor')) {
         if (imageistruecolor($this->ImageID)) {
             if (function_exists('imageantialias')) {
                 imageantialias($this->ImageID, true);
             }
             imagealphablending($this->ImageID, false);
             if (function_exists('imagesavealpha')) {
                 $this->Alpha = true;
                 imagesavealpha($this->ImageID, true);
             }
         }
     }
     $this->ChangeFlag = true;
     if ($this->ImageID) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:GabrielAnca,项目名称:icy_phoenix,代码行数:57,代码来源:class_image.php

示例14: create_thumb

function create_thumb($path, $thumb_path, $width = THUMB_WIDTH, $height = THUMB_HEIGHT)
{
    $image_info = getImageSize($path);
    // see EXIF for faster way
    switch ($image_info['mime']) {
        case 'image/gif':
            if (imagetypes() & IMG_GIF) {
                // not the same as IMAGETYPE
                $o_im = @imageCreateFromGIF($path);
            } else {
                throw new Exception('GIF images are not supported');
            }
            break;
        case 'image/jpeg':
            if (imagetypes() & IMG_JPG) {
                $o_im = @imageCreateFromJPEG($path);
            } else {
                throw new Exception('JPEG images are not supported');
            }
            break;
        case 'image/png':
            if (imagetypes() & IMG_PNG) {
                $o_im = @imageCreateFromPNG($path);
            } else {
                throw new Exception('PNG images are not supported');
            }
            break;
        case 'image/wbmp':
            if (imagetypes() & IMG_WBMP) {
                $o_im = @imageCreateFromWBMP($path);
            } else {
                throw new Exception('WBMP images are not supported');
            }
            break;
        default:
            throw new Exception($image_info['mime'] . ' images are not supported');
            break;
    }
    list($o_wd, $o_ht, $html_dimension_string) = $image_info;
    $ratio = $o_wd / $o_ht;
    $t_ht = $width;
    $t_wd = $height;
    if (1 > $ratio) {
        $t_wd = round($o_wd * $t_wd / $o_ht);
    } else {
        $t_ht = round($o_ht * $t_ht / $o_wd);
    }
    $t_wd = $t_wd < 1 ? 1 : $t_wd;
    $t_ht = $t_ht < 1 ? 1 : $t_ht;
    $t_im = imageCreateTrueColor($t_wd, $t_ht);
    imageCopyResampled($t_im, $o_im, 0, 0, 0, 0, $t_wd, $t_ht, $o_wd, $o_ht);
    imagejpeg($t_im, $thumb_path, 85);
    chmod($thumb_path, 0664);
    imageDestroy($o_im);
    imageDestroy($t_im);
    return array($t_wd, $t_ht);
}
开发者ID:sztanpet,项目名称:aoiboard,代码行数:57,代码来源:functions.php

示例15: supportedTypes

 function supportedTypes()
 {
     $t = array();
     $t['image/jpeg'] = 'jpg';
     if (imagetypes() & IMG_PNG) {
         $t['image/png'] = 'png';
     }
     return $t;
 }
开发者ID:Mauru,项目名称:red,代码行数:9,代码来源:photo_gd.php


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