本文整理汇总了PHP中ImageCreateFromWBMP函数的典型用法代码示例。如果您正苦于以下问题:PHP ImageCreateFromWBMP函数的具体用法?PHP ImageCreateFromWBMP怎么用?PHP ImageCreateFromWBMP使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ImageCreateFromWBMP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: thumbnail
private function thumbnail($imgfile)
{
//detect image format
$this->acHWArr = getimagesize($imgfile);
$this->img["format"] = ereg_replace(".*\\.(.*)\$", "\\1", $imgfile);
$this->img["format"] = strtoupper($this->img["format"]);
if ($this->img["format"] == "JPG" || $this->img["format"] == "JPEG") {
//JPEG
$this->img["format"] = "JPEG";
$this->img["src"] = ImageCreateFromJPEG($imgfile);
} elseif ($this->img["format"] == "PNG") {
//PNG
$this->img["format"] = "PNG";
$this->img["src"] = ImageCreateFromPNG($imgfile);
} elseif ($this->img["format"] == "GIF") {
//GIF
$this->img["format"] = "GIF";
$this->img["src"] = ImageCreateFromGIF($imgfile);
} elseif ($this->img["format"] == "WBMP") {
//WBMP
$this->img["format"] = "WBMP";
$this->img["src"] = ImageCreateFromWBMP($imgfile);
} else {
//DEFAULT
echo "Not Supported File <a href='" . $_SERVER[HTTP_REFERER] . "'>Back</a>";
exit;
}
@($this->img["lebar"] = imagesx($this->img["src"]));
@($this->img["tinggi"] = imagesy($this->img["src"]));
//default quality jpeg
$this->img["quality"] = 75;
}
示例2: ImageManipulation
/**
* Contructor method. Will create a new image from the target file.
* Accepts an image filename as a string. Method also works out how
* big the image is and stores this in the $image array.
*
* @param string $imgFile The image filename.
*/
public function ImageManipulation($imgfile)
{
//detect image format
$this->image["format"] = preg_replace("/.*\\.(.*)\$/", "\\1", $imgfile);
//$this->image["format"] = preg_replace(".*\.(.*)$", "\\1", $imgfile);
$this->image["format"] = strtoupper($this->image["format"]);
// convert image into usable format.
if ($this->image["format"] == "JPG" || $this->image["format"] == "JPEG") {
//JPEG
$this->image["format"] = "JPEG";
$this->image["src"] = ImageCreateFromJPEG($imgfile);
} elseif ($this->image["format"] == "PNG") {
//PNG
$this->image["format"] = "PNG";
$this->image["src"] = imagecreatefrompng($imgfile);
} elseif ($this->image["format"] == "GIF") {
//GIF
$this->image["format"] = "GIF";
$this->image["src"] = ImageCreateFromGif($imgfile);
} elseif ($this->image["format"] == "WBMP") {
//WBMP
$this->image["format"] = "WBMP";
$this->image["src"] = ImageCreateFromWBMP($imgfile);
} else {
//DEFAULT
return false;
}
// Image is ok
$this->imageok = true;
// Work out image size
$this->image["sizex"] = imagesx($this->image["src"]);
$this->image["sizey"] = imagesy($this->image["src"]);
}
示例3: thumbnail
function thumbnail($imgfile, $format = "image/jpeg")
{
//detect image format
$pos = strpos($format, "/");
$this->img["format"] = strtoupper(substr($format, $pos + 1));
//$this->img["format"]=ereg_replace(".*\.(.*)$","\\1",$imgfile);
//$this->img["format"]=strtoupper($this->img["format"]);
if ($this->img["format"] == "JPG" || $this->img["format"] == "JPEG") {
//JPEG
$this->img["format"] = "JPEG";
$this->img["src"] = ImageCreateFromJPEG($imgfile);
} elseif ($this->img["format"] == "PNG") {
//PNG
$this->img["format"] = "PNG";
$this->img["src"] = ImageCreateFromPNG($imgfile);
} elseif ($this->img["format"] == "GIF") {
//GIF
$this->img["format"] = "GIF";
$this->img["src"] = ImageCreateFromGIF($imgfile);
} elseif ($this->img["format"] == "WBMP") {
//WBMP
$this->img["format"] = "WBMP";
$this->img["src"] = ImageCreateFromWBMP($imgfile);
} else {
//DEFAULT
echo "Not Supported File ";
$this->is_img = false;
return;
//exit();
}
@($this->img["lebar"] = imagesx($this->img["src"]));
@($this->img["tinggi"] = imagesy($this->img["src"]));
//default quality jpeg
$this->img["quality"] = 75;
}
示例4: thumbnail
function thumbnail($imgfile)
{
//detect image format
//$this->img["format"]=ereg_replace(".*\.(.*)$","\\1",$imgfile);
$this->img["format"] = preg_replace('/.*\\.(.*)$/', "\\1", $imgfile);
$this->img["format"] = strtoupper($this->img["format"]);
if ($this->img["format"] == "JPG" || $this->img["format"] == "JPEG") {
//JPEG
$this->img["format"] = "JPEG";
$this->img["src"] = ImageCreateFromJPEG($imgfile);
} elseif ($this->img["format"] == "PNG") {
//PNG
$this->img["format"] = "PNG";
$this->img["src"] = ImageCreateFromPNG($imgfile);
} elseif ($this->img["format"] == "GIF") {
//GIF
$this->img["format"] = "GIF";
$this->img["src"] = ImageCreateFromGIF($imgfile);
} elseif ($this->img["format"] == "WBMP") {
//WBMP
$this->img["format"] = "WBMP";
$this->img["src"] = ImageCreateFromWBMP($imgfile);
} else {
//DEFAULT
echo "Not Supported File";
exit;
}
@($this->img["lebar"] = imagesx($this->img["src"]));
@($this->img["tinggi"] = imagesy($this->img["src"]));
//default quality jpeg
$this->img["quality"] = 75;
}
示例5: ImageManipulation
/**
* Contructor method. Will create a new image from the target file.
* Accepts an image filename as a string. Method also works out how
* big the image is and stores this in the $image array.
*
* @param string $imgFile The image filename.
*/
public function ImageManipulation($imgfile)
{
//detect image format
$this->image["format"] = strtolower(substr(strrchr($imgfile, '.'), 1));
$this->image["format"] = strtoupper($this->image["format"]);
// convert image into usable format.
if ($this->image["format"] == "JPG" || $this->image["format"] == "JPEG") {
//JPEG
$this->image["format"] = "JPEG";
$this->image["src"] = ImageCreateFromJPEG($imgfile);
} elseif ($this->image["format"] == "PNG") {
//PNG
$this->image["format"] = "PNG";
$this->image["src"] = imagecreatefrompng($imgfile);
} elseif ($this->image["format"] == "GIF") {
//GIF
$this->image["format"] = "GIF";
$this->image["src"] = ImageCreateFromGif($imgfile);
} elseif ($this->image["format"] == "WBMP") {
//WBMP
$this->image["format"] = "WBMP";
$this->image["src"] = ImageCreateFromWBMP($imgfile);
} else {
//DEFAULT
return false;
}
// Image is ok
$this->imageok = true;
// Work out image size
$this->image["sizex"] = imagesx($this->image["src"]);
$this->image["sizey"] = imagesy($this->image["src"]);
}
示例6: thumbnail
function thumbnail($imgfile)
{
// ----- imagepfad speichern
$this->imgfile = $imgfile;
// ----- gif support ?
$this->gifsupport = false;
if (function_exists('imageGIF')) {
$this->gifsupport = true;
}
// ----- detect image format
$this->img['format'] = ereg_replace('.*\\.(.*)$', '\\1', $imgfile);
$this->img['format'] = strtoupper($this->img['format']);
if (!eregi('cache/', $imgfile)) {
if ($this->img['format'] == 'JPG' || $this->img['format'] == 'JPEG') {
// --- JPEG
$this->img['format'] = 'JPEG';
$this->img['src'] = @ImageCreateFromJPEG($imgfile);
} elseif ($this->img['format'] == 'PNG') {
// --- PNG
$this->img['src'] = @ImageCreateFromPNG($imgfile);
} elseif ($this->img['format'] == 'GIF') {
// --- GIF
if ($this->gifsupport) {
$this->img['src'] = @ImageCreateFromGIF($imgfile);
}
} elseif ($this->img['format'] == 'WBMP') {
// --- WBMP
$this->img['src'] = @ImageCreateFromWBMP($imgfile);
}
// ggf error image senden
if (!$this->img['src']) {
global $REX;
$file = $REX['INCLUDE_PATH'] . '/addons/image_resize/media/warning.jpg';
header('Content-Type: image/JPG');
// error image nicht cachen
header('Cache-Control: false');
readfile($file);
exit;
}
$this->img['width'] = imagesx($this->img['src']);
$this->img['height'] = imagesy($this->img['src']);
$this->img['width_offset_thumb'] = 0;
$this->img['height_offset_thumb'] = 0;
// --- default quality jpeg
$this->img['quality'] = 75;
$this->filters = array();
}
}
示例7: thumbnail
/**
* constructor for resizing image
* @internal
* @$this->img["lebar"] source image X
* @$this->img['tinggi'] source image Y
*
* @param string $imgfile
* @return void
*/
function thumbnail($imgfile)
{
if (!file_exists($imgfile)) {
return false;
}
ini_set('display_errors', '0');
$this->sSourcePath2file = $imgfile;
$this->img["src"] = $imgfile;
$aImageSize = getimagesize($imgfile);
$this->img['format'] = $aImageSize[2];
if (extension_loaded('gd') || extension_loaded('gd2')) {
set_time_limit('6000');
ini_set('memory_limit', '100M');
ini_set('post_max_size', '7M');
switch ($this->img['format']) {
case IMAGETYPE_GIF:
$this->img['src'] = ImageCreateFromGIF($imgfile);
break;
case IMAGETYPE_JPEG:
$this->img['src'] = ImageCreateFromJPEG($imgfile);
break;
case IMAGETYPE_PNG:
$this->img['src'] = ImageCreateFromPNG($imgfile);
break;
case IMAGETYPE_WBMP:
$this->img['src'] = ImageCreateFromWBMP($imgfile);
break;
default:
echo 'Not Supported File';
exit;
}
}
/**
* @$this->img["lebar"] image X
* @$this->img['tinggi'] image Y
*/
$this->img['lebar'] = $this->img["lebar_thumb"] = $this->img["width"] = $aImageSize[0];
//imagesx($this->img["src"]);
$this->img['tinggi'] = $this->img["tinggi_thumb"] = $this->img["height"] = $aImageSize[1];
// imagesy($this->img["src"]);
//default quality jpeg
$this->img["quality"] = 85;
$this->img['src_x'] = 0;
$this->img['src_y'] = 0;
}
示例8: ImageManipulation
/**
* Contructor method. Will create a new image from the target file.
* Accepts an image filename as a string. Method also works out how
* big the image is and stores this in the $image array.
*
* @param string $imgFile The image filename.
*/
public function ImageManipulation($imgfile)
{
$imageinfo = getimagesize($imgfile);
// debugLog($imageinfo);
//detect image format
//@todo: abstract use mime, and realpathparts not regex
$this->image["format"] = $this->getFileImageType($imgfile);
// convert image into usable format.
if ($this->image["format"] == "JPG" || $this->image["format"] == "JPEG") {
//JPEG
$this->image["format"] = "JPEG";
$this->image["src"] = ImageCreateFromJPEG($imgfile);
} elseif ($this->image["format"] == "PNG") {
//PNG
$this->image["format"] = "PNG";
$this->image["src"] = imagecreatefrompng($imgfile);
} elseif ($this->image["format"] == "GIF") {
//GIF
$this->image["format"] = "GIF";
$this->image["src"] = ImageCreateFromGif($imgfile);
} elseif ($this->image["format"] == "WBMP") {
//WBMP
$this->image["format"] = "WBMP";
$this->image["src"] = ImageCreateFromWBMP($imgfile);
} else {
//DEFAULT
$this->imageok = false;
return false;
}
// Image is ok
$this->imageok = true;
// Work out image size
$this->image['srcfile'] = $imgfile;
$this->image['sizex'] = $imageinfo[0];
$this->image['sizey'] = $imageinfo[1];
$this->image['channels'] = $imageinfo[2];
$this->image['bits'] = $imageinfo['bits'];
$this->image['mime'] = $imageinfo['mime'];
$this->image['width'] = $this->image["sizex"];
$this->image['height'] = $this->image["sizey"];
$this->image["ratio"] = $this->getRatio();
}
示例9: thumbnail
function thumbnail($imgfile)
{
// ----- imagepfad speichern
$this->imgfile = $imgfile;
// ----- gif support ?
$this->gifsupport = false;
if (function_exists('imageGIF')) {
$this->gifsupport = true;
}
// ----- detect image format
$this->img["format"] = ereg_replace(".*\\.(.*)\$", "\\1", $imgfile);
$this->img["format"] = strtoupper($this->img["format"]);
if (!eregi('cache/', $imgfile)) {
if ($this->img["format"] == "JPG" || $this->img["format"] == "JPEG") {
// --- JPEG
$this->img["format"] = "JPEG";
$this->img["src"] = ImageCreateFromJPEG($imgfile);
} elseif ($this->img["format"] == "PNG") {
// --- PNG
$this->img["format"] = "PNG";
$this->img["src"] = ImageCreateFromPNG($imgfile);
} elseif ($this->img["format"] == "GIF") {
// --- GIF
$this->img["format"] = "GIF";
if ($this->gifsupport) {
$this->img["src"] = ImageCreateFromGIF($imgfile);
}
} elseif ($this->img["format"] == "WBMP") {
// --- WBMP
$this->img["format"] = "WBMP";
$this->img["src"] = ImageCreateFromWBMP($imgfile);
} else {
// --- DEFAULT
echo "Not Supported File";
exit;
}
@($this->img["width"] = imagesx($this->img["src"]));
@($this->img["height"] = imagesy($this->img["src"]));
// --- default quality jpeg
$this->img["quality"] = 75;
}
}
示例10: rex_thumbnail
function rex_thumbnail($imgfile)
{
global $REX;
// ----- imagepfad speichern
$this->img = array();
$this->imgfile = $imgfile;
// ----- gif support ?
$this->gifsupport = function_exists('imageGIF');
// ----- detect image format
$this->img['format'] = strtoupper(OOMedia::_getExtension($imgfile));
$this->img['src'] = false;
if (strpos($imgfile, 'cache/') === false) {
if ($this->img['format'] == 'JPG' || $this->img['format'] == 'JPEG') {
// --- JPEG
$this->img['format'] = 'JPEG';
$this->img['src'] = @ImageCreateFromJPEG($imgfile);
} elseif ($this->img['format'] == 'PNG') {
// --- PNG
$this->img['src'] = @ImageCreateFromPNG($imgfile);
} elseif ($this->img['format'] == 'GIF') {
// --- GIF
if ($this->gifsupport) {
$this->img['src'] = @ImageCreateFromGIF($imgfile);
}
} elseif ($this->img['format'] == 'WBMP') {
// --- WBMP
$this->img['src'] = @ImageCreateFromWBMP($imgfile);
}
// ggf error image senden
if (!$this->img['src']) {
$this->sendError();
exit;
}
$this->img['width'] = imagesx($this->img['src']);
$this->img['height'] = imagesy($this->img['src']);
$this->img['width_offset_thumb'] = 0;
$this->img['height_offset_thumb'] = 0;
// --- default quality jpeg
$this->img['quality'] = $REX['ADDON']['image_resize']['jpg_quality'];
$this->filters = array();
}
}
示例11: imageMagic
//.........这里部分代码省略.........
$image1 = ImageCreateFromJPEG($fileIn);
} catch (\Exception $exception) {
$errorMsg = 'ErrorJPGFunction';
return false;
}
break;
case IMAGETYPE_PNG:
if (!function_exists('ImageCreateFromPNG')) {
$errorMsg = 'ErrorNoPNGFunction';
return false;
}
//$image1 = ImageCreateFromPNG($fileIn);
try {
$image1 = ImageCreateFromPNG($fileIn);
} catch (\Exception $exception) {
$errorMsg = 'ErrorPNGFunction';
return false;
}
break;
case IMAGETYPE_GIF:
if (!function_exists('ImageCreateFromGIF')) {
$errorMsg = 'ErrorNoGIFFunction';
return false;
}
//$image1 = ImageCreateFromGIF($fileIn);
try {
$image1 = ImageCreateFromGIF($fileIn);
} catch (\Exception $exception) {
$errorMsg = 'ErrorGIFFunction';
return false;
}
break;
case IMAGETYPE_WBMP:
if (!function_exists('ImageCreateFromWBMP')) {
$errorMsg = 'ErrorNoWBMPFunction';
return false;
}
//$image1 = ImageCreateFromWBMP($fileIn);
try {
$image1 = ImageCreateFromWBMP($fileIn);
} catch (\Exception $exception) {
$errorMsg = 'ErrorWBMPFunction';
return false;
}
break;
default:
$errorMsg = 'ErrorNotSupportedImage';
return false;
break;
}
if ($image1) {
$image2 = @ImageCreateTruecolor($dst[2], $dst[3]);
if (!$image2) {
$errorMsg = 'ErrorNoImageCreateTruecolor';
return false;
}
switch ($type) {
case IMAGETYPE_PNG:
//imagealphablending($image1, false);
@imagealphablending($image2, false);
//imagesavealpha($image1, true);
@imagesavealpha($image2, true);
break;
}
ImageCopyResampled($image2, $image1, $dst[0], $dst[1], $src[0], $src[1], $dst[2], $dst[3], $src[2], $src[3]);
// Watermark - - - - - -
示例12: picture_openrandomformat
function picture_openrandomformat($image, $mime = false){
if ($mime == false && strtolower(substr($image, 0, 7)) == "http://"){
$last4 = strtolower(substr($image, -4));
$last5 = strtolower(substr($image, -5));
if ($last4 == ".jpg" || $last5 == ".jpeg"){
$mime = "image/jpeg";
}elseif($last4 == ".gif"){
$mime = "image/gif";
}elseif($last4 == ".bmp"){
$mime = "image/bmp";
}elseif($last4 == ".png"){
$mime = "image/png";
}
}
if ($mime == false){
$mime = GetImageSize($image);
$mime = $mime["mime"];
}
if ($mime == "image/jpeg"){
return ImageCreateFromJPEG($image);
}elseif($mime == "image/gif"){
$img = ImageCreateFromGIF($image);
}elseif($mime == "image/bmp"){
require_once("knj/functions_knj_picture_bmp.php");
return ImageCreateFromBMP($image);
}elseif($mime == "image/vnd.wbmp"){
return ImageCreateFromWBMP($image);
}elseif($mime == "image/png"){
$img = ImageCreateFromPNG($image);
}else{
return false;
}
return $img;
}
示例13: createThumb
public function createThumb($dir, $prefix, $max_x = false, $max_y = false, $prefixIsRealName = false, $mode = 'square')
{
if (!isset($this->hash)) {
return FALSE;
}
if (!$dir) {
$dir = dirname($this->file);
}
if (!$prefix) {
$prefix = 't';
}
if (!$max_x && !$max_y || intval($max_x) <= 0 && intval($max_y) <= 0) {
throw new PException('Neither thumbnail max-width nor max-height provided!');
}
$size_x = $this->imageSize[0];
$size_y = $this->imageSize[1];
// old school
if (!$max_x || !$max_y) {
if ($max_x && intval($max_x) > 0 && $size_x) {
$th_size_x = intval($max_x);
$th_size_y = intval($size_y * $th_size_x / $size_x);
$size_x = $th_size_x;
$size_y = $th_size_y;
}
if ($max_y && intval($max_y) > 0 && $size_y > $max_y) {
$th_size_y = intval($max_y);
$th_size_x = intval($size_x * $th_size_y / $size_y);
}
$startx = 0;
$starty = 0;
$size_x = $this->imageSize[0];
$size_y = $this->imageSize[1];
} else {
switch ($mode) {
case "ratio":
if ($max_x / $size_x >= $max_y / $size_y) {
$ratio = $max_y / $size_y;
} else {
$ratio = $max_x / $size_x;
}
$startx = 0;
$starty = 0;
break;
default:
if ($size_x >= $size_y) {
$startx = ($size_x - $size_y) / 2;
$starty = 0;
$size_x = $size_y;
} else {
$starty = ($size_y - $size_x) / 2;
$startx = 0;
$size_y = $size_x;
}
if ($max_x >= $max_y) {
$ratio = $max_y / $size_y;
} else {
$ratio = $max_x / $size_x;
}
break;
}
$th_size_x = $size_x * $ratio;
$th_size_y = $size_y * $ratio;
}
switch (intval($this->imageSize[2])) {
// note: fixed this to use the proper constants. IMG_*** are GD constants, IMAGETYPE_*** are PHP constants.
// The two DO NOT mix
case IMAGETYPE_GIF:
$oldImage = ImageCreateFromGIF($this->file);
break;
case IMAGETYPE_JPEG:
$oldImage = ImageCreateFromJPEG($this->file);
break;
case IMAGETYPE_PNG:
$oldImage = ImageCreateFromPNG($this->file);
break;
case IMAGETYPE_WBMP:
$oldImage = ImageCreateFromWBMP($this->file);
break;
default:
$e = new PException('Image type not supported!');
$e->addInfo(print_r($this->imageSize, TRUE));
throw $e;
break;
}
$newImage = ImageCreateTrueColor($th_size_x, $th_size_y);
imageCopyResampled($newImage, $oldImage, 0, 0, $startx, $starty, $th_size_x, $th_size_y, $size_x, $size_y);
$newFile = tempnam('Lorem ipsum dolor sit amet', 'thumb');
switch ($this->imageSize[2]) {
case IMAGETYPE_GIF:
ImageTrueColorToPalette($newImage, TRUE, 256);
ImageGIF($newImage, $newFile);
$mimetype = 'image/gif';
break;
case IMAGETYPE_JPEG:
ImageJPEG($newImage, $newFile);
$mimetype = 'image/jpeg';
break;
case IMAGETYPE_PNG:
ImagePNG($newImage, $newFile);
$mimetype = 'image/png';
//.........这里部分代码省略.........
示例14: CreateFromFile
/**
* Создает новое изображение из файла
* @param $ImgFileName
* @param int $Width
* @param int $Height
* @return mixed
*/
public function CreateFromFile($ImgFileName, $Width = 0, $Height = 0)
{
if (!file_exists($ImgFileName)) {
ErrorHandler(USER_NOTICE, 'Файл не найден', 'TPicture::CreateFromFile');
return;
}
if ($this->gd != null) {
$this->Destruct();
}
$size = getimagesize($ImgFileName);
$format = strtolower(substr($size['mime'], strpos($size['mime'], '/') + 1));
$vformat = false;
if ($format == 'jpg' || $format == 'jpeg') {
$vformat = true;
$this->Format = IMAGE_JPEG;
$this->gd = ImageCreateFromJPEG($ImgFileName);
} elseif ($format == 'png') {
$vformat = true;
$this->Format = IMAGE_PNG;
$this->gd = ImageCreateFromPNG($ImgFileName);
} elseif ($format == 'gif') {
$vformat = true;
$this->Format = IMAGE_GIF;
$this->gd = ImageCreateFromGIF($ImgFileName);
} elseif ($format == 'wbmp') {
$vformat = true;
$this->Format = IMAGE_WBMP;
$this->gd = ImageCreateFromWBMP($ImgFileName);
}
if ($vformat) {
$this->SaveFormat = $this->Format;
$this->Width = $size[0];
$this->Height = $size[1];
$this->NewWidth = 0;
$this->NewHeight = 0;
$this->JpegQuality = 95;
}
}
示例15: create
private function create()
{
if (!isset($this->error) and preg_match("/^[0-9]{1,2}\$/", $this->type)) {
switch ($this->type) {
case 1:
return ImageCreateFromGIF($this->photo);
break;
case 3:
return ImageCreateFromPNG($this->photo);
break;
case 6:
case 15:
return ImageCreateFromWBMP($this->photo);
break;
default:
return ImageCreateFromJPEG($this->photo);
}
}
}