本文整理汇总了PHP中imagetypes函数的典型用法代码示例。如果您正苦于以下问题:PHP imagetypes函数的具体用法?PHP imagetypes怎么用?PHP imagetypes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imagetypes函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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é 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ée par Iconito.');
}
if (ini_get('session.auto_start')) {
$data['caninstall'] = false;
$data['errors'][] = array('level' => 'error', 'code' => 'session_autostart', 'message' => 'Vous devez désactiver la cré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écifiquement), ou dans le .htaccess d\'Iconito (dans le répertoire "Iconito/www").');
} else {
$data['errors'][] = array('level' => 'good', 'code' => 'session_autostart', 'message' => 'La création de session automatique est désactivé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é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é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é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é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\'écriture du format GIF. Il est préférable de mettre à 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é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
示例16: load
/**
* Bild oeffnen
*/
public function load()
{
// Evtl. geoeffnetes Bild schliessen
$this->close();
// Bildinformationen ermitteln
$imageInfo = $this->getImageInfo();
$this->imageType = $imageInfo['gdType'];
// Je nach Bildtyp das Bild oeffnen
switch ($imageInfo['gdType']) {
case IMAGETYPE_JPEG:
if (imagetypes() & IMG_JPG && function_exists('imagecreatefromjpeg')) {
// Typ setzen
$this->imageType = self::TYPE_JPG;
// JPG oeffnen
$this->image = imagecreatefromjpeg($this->imageFile);
}
break;
case IMAGETYPE_GIF:
if (imagetypes() & IMG_GIF && function_exists('imagecreatefromgif')) {
// Typ setzen
$this->imageType = self::TYPE_GIF;
// GIF oeffnen
$this->image = imagecreatefromgif($this->imageFile);
}
break;
case IMAGETYPE_PNG:
if (imagetypes() & IMG_PNG && function_exists('imagecreatefrompng')) {
// Typ setzen
$this->imageType = self::TYPE_PNG;
// PNG oeffnen
$this->image = imagecreatefrompng($this->imageFile);
imagealphablending($this->image, true);
imagesavealpha($this->image, true);
}
break;
case IMAGETYPE_WBMP:
if (imagetypes() & IMG_WBMP && function_exists('imagecreatefromwbmp')) {
// Typ setzen
$this->imageType = self::TYPE_WBMP;
// WBMP oeffnen
$this->image = imagecreatefromwbmp($this->imageFile);
}
break;
default:
// Fehler! Bild-Type nicht unterstuetzt
return false;
}
// Bild geoeffnet?
if ($this->image) {
$this->_loaded = true;
return true;
}
// Bild nicht geladen
return false;
}
开发者ID:rukzuk,项目名称:rukzuk,代码行数:58,代码来源:Phpgd.php
示例17: file_support_thumbnail
/**
* Check if system could make thumbnail for current file.
* @param (string) path to file
* @return (boolean)
*/
public function file_support_thumbnail($file)
{
$info = getimagesize($file);
$type = isset($info['type']) ? $info['type'] : $info[2];
// Check support of file type
if (!(imagetypes() & $type)) {
// Server does not support file type
return false;
}
return true;
}
开发者ID:juggernautsei,项目名称:openemr,代码行数:16,代码来源:Thumbnail.class.php
示例18: get_system_info
/**
* 获得系统的信息
*
* @access public
* @return array 系统各项信息组成的数组
*/
function get_system_info($_LANG = array())
{
$system_info = array();
/* 检查系统基本参数 */
$system_info[] = array($_LANG['php_os'], PHP_OS);
$system_info[] = array($_LANG['php_ver'], PHP_VERSION);
/* 检查MYSQL支持情况 */
$mysql_enabled = function_exists('mysql_connect') ? $_LANG['support'] : $_LANG['not_support'];
$system_info[] = array($_LANG['does_support_mysql'], $mysql_enabled);
/* 检查图片处理函数库 */
$gd_ver = get_gd_version();
$gd_ver = empty($gd_ver) ? $_LANG['not_support'] : $gd_ver;
if ($gd_ver > 0) {
if (PHP_VERSION >= '4.3' && function_exists('gd_info')) {
$gd_info = gd_info();
$jpeg_enabled = $gd_info['JPEG Support'] === true ? $_LANG['support'] : $_LANG['not_support'];
$gif_enabled = $gd_info['GIF Create Support'] === true ? $_LANG['support'] : $_LANG['not_support'];
$png_enabled = $gd_info['PNG Support'] === true ? $_LANG['support'] : $_LANG['not_support'];
} else {
if (function_exists('imagetypes')) {
$jpeg_enabled = (imagetypes() & IMG_JPG) > 0 ? $_LANG['support'] : $_LANG['not_support'];
$gif_enabled = (imagetypes() & IMG_GIF) > 0 ? $_LANG['support'] : $_LANG['not_support'];
$png_enabled = (imagetypes() & IMG_PNG) > 0 ? $_LANG['support'] : $_LANG['not_support'];
} else {
$jpeg_enabled = $_LANG['not_support'];
$gif_enabled = $_LANG['not_support'];
$png_enabled = $_LANG['not_support'];
}
}
} else {
$jpeg_enabled = $_LANG['not_support'];
$gif_enabled = $_LANG['not_support'];
$png_enabled = $_LANG['not_support'];
}
$system_info[] = array($_LANG['gd_version'], $gd_ver);
$system_info[] = array($_LANG['jpeg'], $jpeg_enabled);
$system_info[] = array($_LANG['gif'], $gif_enabled);
$system_info[] = array($_LANG['png'], $png_enabled);
/* 检查系统是否支持以dwt,lib,dat为扩展名的文件 */
// $file_types = array(
// 'dwt' => ROOT_PATH . 'themes/default/index.dwt',
// 'lbi' => ROOT_PATH . 'themes/default/library/member.lbi',
// 'dat' => ROOT_PATH . 'includes/codetable/ipdata.dat'
// );
// $exists_info = file_types_exists($file_types);
// $exists_info = empty($exists_info) ? $_LANG['support_dld'] : $exists_info;
// $system_info[] = array($_LANG['does_support_dld'], $exists_info);
/* 服务器是否安全模式开启 */
$safe_mode = ini_get('safe_mode') == '1' ? $_LANG['safe_mode_on'] : $_LANG['safe_mode_off'];
$system_info[] = array($_LANG['safe_mode'], $safe_mode);
return $system_info;
}
开发者ID:hobbysh,项目名称:seevia-opensource,代码行数:58,代码来源:lib_installer.php
示例19: supports_mime_type
/**
* Checks to see if editor supports the mime-type specified.
*
* @since 3.5.0
* @access public
*
* @param string $mime_type
* @return boolean
*/
public static function supports_mime_type($mime_type)
{
$image_types = imagetypes();
switch ($mime_type) {
case 'image/jpeg':
return ($image_types & IMG_JPG) != 0;
case 'image/png':
return ($image_types & IMG_PNG) != 0;
case 'image/gif':
return ($image_types & IMG_GIF) != 0;
}
return false;
}
开发者ID:Didox,项目名称:beminfinito,代码行数:22,代码来源:class-wp-image-editor-gd.php
示例20: gd_capabilities
function gd_capabilities()
{
if (function_exists("imageCreate")) {
define("_JB_GD_INSTALLED", true);
/* Note on shorthands:
* ($foo == "bar") ? true : false
*/
define("_JB_GD_GIF", imagetypes() & IMG_GIF ? true : false);
define("_JB_GD_PNG", imagetypes() & IMG_PNG ? true : false);
define("_JB_GD_JPEG", imagetypes() & IMG_JPG ? true : false);
} else {
define("_JB_GD_INSTALLED", false);
}
}
开发者ID:victorjacobs,项目名称:jetbird,代码行数:14,代码来源:image.functions.php
注:本文中的imagetypes函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论