本文整理汇总了PHP中imageWBMP函数的典型用法代码示例。如果您正苦于以下问题:PHP imageWBMP函数的具体用法?PHP imageWBMP怎么用?PHP imageWBMP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imageWBMP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save($save)
{
/* change ImageCreateTrueColor to ImageCreate if your GD not supported ImageCreateTrueColor function*/
$this->img["des"] = ImageCreateTrueColor($this->img["lebar_thumb"], $this->img["tinggi_thumb"]);
@imagecopyresized($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]);
if ($this->img["format"] == "JPG" || $this->img["format"] == "JPEG") {
//JPEG
imageJPEG($this->img["des"], "{$save}", $this->img["quality"]);
} elseif ($this->img["format"] == "PNG") {
//PNG
imagePNG($this->img["des"], "{$save}");
} elseif ($this->img["format"] == "GIF") {
//GIF
imageGIF($this->img["des"], "{$save}");
} elseif ($this->img["format"] == "WBMP") {
//WBMP
imageWBMP($this->img["des"], "{$save}");
}
}
示例2: __write
/**
* Write the image after being processed
*
* @param Asido_TMP &$tmp
* @return boolean
* @access protected
*/
function __write(&$tmp)
{
// try to guess format from extension
//
if (!$tmp->save) {
$p = pathinfo($tmp->target_filename);
($tmp->save = $this->__mime_metaphone[metaphone($p['extension'])]) || ($tmp->save = $this->__mime_soundex[soundex($p['extension'])]);
}
$result = false;
switch ($tmp->save) {
case 'image/gif':
imageTrueColorToPalette($tmp->target, true, 256);
$result = @imageGIF($tmp->target, $tmp->target_filename);
break;
case 'image/jpeg':
$result = @imageJPEG($tmp->target, $tmp->target_filename, ASIDO_GD_JPEG_QUALITY);
break;
case 'image/wbmp':
$result = @imageWBMP($tmp->target, $tmp->target_filename);
break;
default:
case 'image/png':
imageSaveAlpha($tmp->target, true);
imageAlphaBlending($tmp->target, false);
$result = @imagePNG($tmp->target, $tmp->target_filename);
break;
}
@$this->__destroy_source($tmp);
@$this->__destroy_target($tmp);
return $result;
}
示例3: generateImage
function generateImage($save = '', $show = true)
{
if ($this->img["format"] == "GIF" && !$this->gifsupport) {
// --- kein caching -> gif ausgeben
Header("Content-Type: image/" . $this->img["format"]);
readfile($this->imgfile);
exit;
}
$this->resampleImage();
if ($this->img["format"] == "JPG" || $this->img["format"] == "JPEG") {
imageJPEG($this->img["des"], $save, $this->img["quality"]);
} elseif ($this->img["format"] == "PNG") {
imagePNG($this->img["des"], $save);
} elseif ($this->img["format"] == "GIF") {
imageGIF($this->img["des"], $save);
} elseif ($this->img["format"] == "WBMP") {
imageWBMP($this->img["des"], $save);
}
if ($show) {
Header("Content-Type: image/" . $this->img["format"]);
readfile($save);
}
}
示例4: generateImage
function generateImage($file = '', $show = true)
{
global $REX;
if ($this->img['format'] == 'GIF' && !$this->gifsupport) {
// --- kein caching -> gif ausgeben
$this->send();
}
$this->resampleImage();
$this->applyFilters();
$this->checkCacheFiles();
if ($this->img['format'] == 'JPG' || $this->img['format'] == 'JPEG') {
imageJPEG($this->img['des'], $file, $this->img['quality']);
} elseif ($this->img['format'] == 'PNG') {
imagePNG($this->img['des'], $file);
} elseif ($this->img['format'] == 'GIF') {
imageGIF($this->img['des'], $file);
} elseif ($this->img['format'] == 'WBMP') {
imageWBMP($this->img['des'], $file);
}
chmod($file, $REX['FILEPERM']);
if ($show) {
$this->send($file);
}
}
示例5: save
/**
* Saves the image to a given filename, if no filename is given then a default is created.
*
* @param string $save The new image filename.
*/
public function save($save = "")
{
//save thumb
if (empty($save)) {
$save = strtolower("./thumb." . $this->image["format"]);
}
$this->createResampledImage();
if ($this->image["format"] == "JPG" || $this->image["format"] == "JPEG") {
//JPEG
imageJPEG($this->image["des"], $save, $this->image["quality"]);
} elseif ($this->image["format"] == "PNG") {
//PNG
imagePNG($this->image["des"], $save);
} elseif ($this->image["format"] == "GIF") {
//GIF
imageGIF($this->image["des"], $save);
} elseif ($this->image["format"] == "WBMP") {
//WBMP
imageWBMP($this->image["des"], $save);
}
}
示例6: generateImage
function generateImage($save = '', $show = true)
{
if ($this->img['format'] == 'GIF' && !$this->gifsupport) {
// --- kein caching -> gif ausgeben
$this->send();
}
$this->resampleImage();
$this->applyFilters();
if ($this->img['format'] == 'JPG' || $this->img['format'] == 'JPEG') {
imageJPEG($this->img['des'], $save, $this->img['quality']);
} elseif ($this->img['format'] == 'PNG') {
imagePNG($this->img['des'], $save);
} elseif ($this->img['format'] == 'GIF') {
imageGIF($this->img['des'], $save);
} elseif ($this->img['format'] == 'WBMP') {
imageWBMP($this->img['des'], $save);
}
if ($show) {
$this->send($save);
}
}
示例7: generateThumbnail
//.........这里部分代码省略.........
switch (strtolower($this->cropGravity)) {
case 'center':
$src_x = floor(($image_attr[0] - $src_w) / 2);
$src_y = floor(($image_attr[1] - $src_h) / 2);
break;
case 'northeast':
$src_x = 0;
$src_y = 0;
break;
case 'north':
$src_x = floor(($image_attr[0] - $src_w) / 2);
$src_y = 0;
break;
case 'south':
$src_x = floor($image_attr[0] - $image_width);
$src_y = floor($image_attr[1] - $image_height);
break;
default:
throw new ThumbnailsException("Unsupported cropGravity for GD: {$this->cropGravity}");
}
} else {
if ($height === 0) {
// resize to max width, preserving aspect ratio
$src_x = 0;
$src_y = 0;
$src_w = $image_width;
$src_h = $image_height;
$dst_w = $width;
$dst_h = $image_height * ($width / $image_width);
} else {
if ($width === 0) {
// resize to max height, preserving aspect ratio
$src_x = 0;
$src_y = 0;
$src_w = $image_width;
$src_h = $image_height;
$dst_h = $height;
$dst_w = $image_width * ($height / $image_height);
} else {
// resize, ignoring aspect ratio
$src_x = 0;
$src_y = 0;
$src_w = $image_width;
$src_h = $image_height;
$dst_w = $width;
$dst_h = $height;
}
}
}
}
$newImage = imagecreateTrueColor($dst_w, $dst_h);
//preserve transparency
$transindex = -1;
if ($ext == 'gif') {
imagealphablending($newImage, false);
$transindex = imagecolortransparent($origImage);
if ($transindex >= 0) {
$transcol = imagecolorsforindex($origImage, $transindex);
$transindex = imagecolorallocatealpha($newImage, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
imagefill($newImage, 0, 0, $transindex);
}
}
@imagecopyResampled($newImage, $origImage, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
//preserve transparency
if ($ext == 'gif') {
if ($transindex >= 0) {
imagecolortransparent($newImage, $transindex);
for ($y = 0; $y < $dst_h; ++$y) {
for ($x = 0; $x < $dst_w; ++$x) {
if ((imagecolorat($newImage, $x, $y) >> 24 & 0x7f) >= 100) {
imagesetpixel($newImage, $x, $y, $transindex);
}
}
}
imagetruecolortopalette($newImage, true, 255);
imagesavealpha($newImage, false);
}
}
// echo "<pre>"; var_dump($dst_h); die("</pre>");
$outfilepath = "{$outputDirectory}/{$outfile}";
switch ($ext) {
case 'jpg':
case 'jpeg':
imageJPEG($newImage, $outfilepath, $quality);
break;
case 'gif':
imageGIF($newImage, $outfilepath);
break;
case 'png':
imagePNG($newImage, $outfilepath, $quality);
break;
case 'bmp':
imageWBMP($newImage, $outfilepath);
break;
}
imagedestroy($newImage);
imagedestroy($origImage);
}
return $outfile;
}
示例8: convertImage
function convertImage($type)
{
/* check the converted image type availability,
if it is not available, it will be casted to jpeg :) */
$validtype = $this->validateType($type);
if ($this->output) {
/* show the image */
switch ($validtype) {
case 'jpeg':
case 'jpg':
header("Content-type: image/jpeg");
if ($this->imtype == 'gif' or $this->imtype == 'png') {
$image = $this->replaceTransparentWhite($this->im);
imageJPEG($image);
} else {
imageJPEG($this->im);
}
break;
case 'gif':
header("Content-type: image/gif");
imageGIF($this->im);
break;
case 'png':
header("Content-type: image/png");
imagePNG($this->im);
break;
case 'wbmp':
header("Content-type: image/vnd.wap.wbmp");
imageWBMP($this->im);
break;
case 'swf':
header("Content-type: application/x-shockwave-flash");
$this->imageSWF($this->im);
break;
}
// Memory cleanup
@imagedestroy($this->im);
} else {
/* save the image */
switch ($validtype) {
case 'jpeg':
case 'jpg':
if ($this->imtype == 'gif' or $this->imtype == 'png') {
/* replace transparent with white */
$image = $this->replaceTransparentWhite($this->im);
imageJPEG($image, $this->finalFilePath . $this->imname . ".jpg");
} else {
imageJPEG($this->im, $this->finalFilePath . $this->imname . ".jpg");
}
break;
case 'gif':
imageGIF($this->im, $this->finalFilePath . $this->imname . ".gif");
break;
case 'png':
imagePNG($this->im, $this->finalFilePath . $this->imname . ".png");
break;
case 'wbmp':
imageWBMP($this->im, $this->finalFilePath . $this->imname . ".wbmp");
break;
case 'swf':
$this->imageSWF($this->im, $this->finalFilePath . $this->imname . ".swf");
break;
}
// Memory cleanup
@imagedestroy($this->im);
}
}
示例9: __write
/**
* Write the image after being processed
*
* @param Asido_TMP &$tmp
* @return boolean
* @access protected
*/
function __write(&$tmp)
{
// try to guess format from extension
//
if (!$tmp->save) {
$p = pathinfo($tmp->target_filename);
($tmp->save = $this->__mime_metaphone[metaphone($p['extension'])]) || ($tmp->save = $this->__mime_soundex[soundex($p['extension'])]);
}
$result = false;
switch ($tmp->save) {
case 'image/gif':
imageTrueColorToPalette($tmp->target, true, 256);
ob_start();
imageGIF($tmp->target);
$contents = ob_get_contents();
ob_end_clean();
break;
case 'image/jpeg':
ob_start();
imageJPEG($tmp->target, null, ASIDO_GD_JPEG_QUALITY);
$contents = ob_get_contents();
ob_end_clean();
break;
case 'image/wbmp':
ob_start();
imageWBMP($tmp->target);
$contents = ob_get_contents();
ob_end_clean();
break;
default:
case 'image/png':
imageSaveAlpha($tmp->target, true);
imageAlphaBlending($tmp->target, false);
ob_start();
imagePNG($tmp->target);
$contents = ob_get_contents();
ob_end_clean();
break;
}
// This needs to go through Joomla as suexec might be present
jimport('joomla.filesystem');
$result = JFile::write($tmp->target_filename, $contents);
$this->__destroy_source($tmp);
$this->__destroy_target($tmp);
return $result;
}
示例10: typeCloseImage
protected function typeCloseImage($pointer, $resource, $filename)
{
$mime = $this->mime[$pointer];
$quality = $this->re_quality[$pointer];
if (imagetypes() & $mime) {
switch ($mime) {
case 2:
return imageJPEG($resource, $filename, $quality);
break;
case 15:
return imageWBMP($resource, $filename, $quality);
break;
case 1:
return imageGIF($resource, $filename, $quality);
break;
case 3:
return imagePNG($resource, $filename, $quality);
break;
}
} else {
return false;
}
}
示例11: SaveToFile
/**
* Сохраняет изображение в файл
* @param $FileName
* @param null $SaveFormat
*/
public function SaveToFile($FileName, $SaveFormat = null)
{
if ($SaveFormat !== null) {
$this->SetSaveFormat($SaveFormat);
}
$this->SetSize();
if ($this->SaveFormat == 'jpeg') {
imageJPEG($this->gd, $FileName, $this->JpegQuality);
} elseif ($this->SaveFormat == 'png') {
imagePNG($this->gd, $FileName);
} elseif ($this->SaveFormat == 'gif') {
imageGIF($this->gd, $FileName);
} elseif ($this->SaveFormat == 'wbmp') {
imageWBMP($this->gd, $FileName);
}
}
示例12: move
private function move()
{
if (!isset($this->error)) {
switch ($this->type) {
case 1:
return imageGIF($this->new_photo, $this->new_name);
break;
case 3:
return imagePNG($this->new_photo, $this->new_name);
break;
case 6:
case 15:
return imageWBMP($this->new_photo, $this->new_name);
break;
default:
return imageJPEG($this->new_photo, $this->new_name, $this->quality);
}
}
}
示例13: putInColorBox_and_save
function putInColorBox_and_save($fileresult, $resultWidth, $resultHeight, $bgColorRed = 0xff, $bgColorGreen = 0xff, $bgColorBlue = 0xff)
{
// get size
$res = getImageSize($this->sSourcePath2file);
$width = $res[0];
$height = $res[1];
// open image
$img_src = $this->img["src"];
// make new size
$newimg_width = $resultWidth;
$newimg_height = $newimg_width / $width * $height;
if ($newimg_height > $resultHeight) {
$newimg_height = $resultHeight;
$newimg_width = $newimg_height / $height * $width;
}
// create img with specific size resultWidth x resultHeight
$im_new = ImageCreateTrueColor($resultWidth, $resultHeight);
// set BG
$color = ImageColorAllocate($im_new, $bgColorRed, $bgColorGreen, $bgColorBlue);
$res = ImageFilledRectangle($im_new, 0, 0, $resultWidth, $resultHeight, $color);
// detact offset
$dX = $resultWidth - $newimg_width;
$dY = $resultHeight - $newimg_height;
$dX /= 2;
$dY /= 2;
//put image to new image
ImageCopyResampled($im_new, $img_src, $dX, $dY, 0, 0, $newimg_width, $newimg_height, $width, $height);
switch ($this->img['format']) {
case IMAGETYPE_GIF:
imageGIF($im_new, $fileresult);
break;
case IMAGETYPE_JPEG:
imageJPEG($im_new, $fileresult, $this->img["quality"]);
break;
case IMAGETYPE_PNG:
imagePNG($im_new, $fileresult);
break;
case IMAGETYPE_WBMP:
imageWBMP($im_new, $fileresult);
break;
}
}
示例14: init_watermark
//.........这里部分代码省略.........
case IMAGETYPE_PNG:
$this->aWatermarkSources[$sWatermark]['src'] = imageCreateFromPNG($sWatermark);
break;
case IMAGETYPE_WBMP:
$this->aWatermarkSources[$sWatermark]['src'] = imageCreateFromWBMP($sWatermark);
break;
default:
return;
}
}
// определяем нужные размеры wm исходя из коэффициентов
if ($this->oImg['watermark_resizeable']) {
$nCoef = $this->oImg['coef_width'] > $this->oImg['coef_height'] ? $this->oImg['coef_height'] : $this->oImg['coef_width'];
$dst_width = intval($this->aWatermarkSources[$sWatermark]['width'] * $nCoef);
$dst_height = intval($this->aWatermarkSources[$sWatermark]['height'] * $nCoef);
} else {
$dst_width = $this->aWatermarkSources[$sWatermark]['width'];
$dst_height = $this->aWatermarkSources[$sWatermark]['height'];
}
$this->oImg['wm'] = imagecreatetruecolor($dst_width, $dst_height);
ImageAlphaBlending($this->oImg['wm'], false);
ImageSaveAlpha($this->oImg['wm'], true);
imagecopyresized($this->oImg['wm'], $this->aWatermarkSources[$sWatermark]['src'], 0, 0, 0, 0, $dst_width, $dst_height, $this->aWatermarkSources[$sWatermark]['width'], $this->aWatermarkSources[$sWatermark]['height']);
$this->oImg['wm_width'] = $dst_width;
$this->oImg['wm_height'] = $dst_height;
$this->oImg['watermark_pos_x'] = $hPosition;
$this->oImg['watermark_pos_y'] = $vPosition;
$this->oImg['watermark_padding_h'] = intval($xPadding * $this->oImg['coef_width']);
$this->oImg['watermark_padding_v'] = intval($yPadding * $this->oImg['coef_height']);
} else {
unset($this->oImg['wm']);
$this->errors->set('watermark_src_isnt_image');
}
} else {
$nCoef = $this->oImg['coef_width'] > $this->oImg['coef_height'] ? $this->oImg['coef_height'] : $this->oImg['coef_width'];
$nFontSize = round($this->oImg['watermark_font_size'] * $nCoef);
$nFontSize = round($nFontSize / 1.333);
//определение координат нужного прямоугольника под WM
$aImageDimmention = imagettfbbox($nFontSize, 0, $this->sFontDir . $this->oImg['watermark_font'], $sWatermark);
//ширина (разница по oX между нижними левым и правым углом прямоугольника)
$nImgWidth = $aImageDimmention[4] - $aImageDimmention[6];
//высота (разница по oY между левыми верхним и нижним углом прямоугольника)
$nImgHeight = $aImageDimmention[1] - $aImageDimmention[7];
if (!$nImgHeight) {
$this->errors->set('no_language_support');
$this->oImg['wm'] = false;
}
if ($this->errors->no()) {
$nImgHeight *= 1.6;
//небольшое увеличение высоты чтобы поместились выступающие края букв
$this->oImg['wm'] = ImageCreateTrueColor($nImgWidth, $nImgHeight);
if ($this->oImg['type'] == IMAGETYPE_GIF) {
//Определяем индекс прозрачного цвета у gif
$colorcount = imagecolorstotal($this->oImg['src']);
imagetruecolortopalette($this->oImg['wm'], true, $colorcount);
imagepalettecopy($this->oImg['wm'], $this->oImg['wm']);
$trans = imagecolortransparent($this->oImg['wm']);
imagefill($this->oImg['wm'], 0, 0, $trans);
imagecolortransparent($this->oImg['wm'], $trans);
$textcolor = imagecolorallocate($this->oImg['wm'], (int) ($this->oImg['watermark_font_color'] % 0x1000000 / 0x10000), (int) ($this->oImg['watermark_font_color'] % 0x10000 / 0x100), $this->oImg['watermark_font_color'] % 0x100);
} else {
//Определяем индекс прозрачного цвета у png
$opacity = imagecolorallocatealpha($this->oImg['wm'], 255, 255, 255, 127);
imagefill($this->oImg['wm'], 0, 0, $opacity);
ImageAlphaBlending($this->oImg['wm'], false);
ImageSaveAlpha($this->oImg['wm'], true);
$textcolor = imagecolorallocatealpha($this->oImg['wm'], (int) ($this->oImg['watermark_font_color'] % 0x1000000 / 0x10000), (int) ($this->oImg['watermark_font_color'] % 0x10000 / 0x100), $this->oImg['watermark_font_color'] % 0x100, 0);
}
// Наносим текст
imagettftext($this->oImg['wm'], $nFontSize, 0, 0, intval($nImgHeight * 0.8), $textcolor, $this->sFontDir . $this->oImg['watermark_font'], $sWatermark);
$this->oImg['wm_width'] = $nImgWidth;
$this->oImg['wm_height'] = $nImgHeight;
$this->oImg['watermark_pos_x'] = $hPosition;
$this->oImg['watermark_pos_y'] = $vPosition;
$this->oImg['watermark_padding_h'] = intval($xPadding * $this->oImg['coef_width']);
$this->oImg['watermark_padding_v'] = intval($yPadding * $this->oImg['coef_height']);
}
}
// нанесение wm на оригинал
if ($bMakeSourceWatermark) {
$this->oImg['only_src'] = imageCreateTrueColor($this->oImg['orig_width'], $this->oImg['orig_height']);
ImageCopy($this->oImg['only_src'], $this->oImg['src'], 0, 0, 0, 0, $this->oImg['orig_width'], $this->oImg['orig_height']);
$this->make_watermark($this->oImg['only_src'], intval($this->oImg['orig_width']), intval($this->oImg['orig_height']));
switch ($this->oImg['format']) {
case IMAGETYPE_GIF:
imageGIF($this->oImg['only_src'], $this->oImg['orig_filename']);
break;
case IMAGETYPE_JPEG:
imageJPEG($this->oImg['only_src'], $this->{$this}->oImg['orig_filename'], $this->oImg['quality']);
break;
case IMAGETYPE_PNG:
imagePNG($this->oImg['only_src'], $this->{$this}->oImg['orig_filename']);
break;
case IMAGETYPE_WBMP:
imageWBMP($this->oImg['only_src'], $this->{$this}->oImg['orig_filename']);
break;
}
imageDestroy($this->oImg['only_src']);
}
}
示例15: convertImage
function convertImage($type)
{
/* check the converted image type availability,
if it is not available, it will be casted to jpeg :) */
$validtype = $this->validateType($type);
if ($this->output) {
/* show the image */
switch ($validtype) {
case 'jpeg':
// Added jpe
// Added jpe
case 'jpe':
case 'jpg':
header("Content-type: image/jpeg");
if ($this->imtype == 'gif' or $this->imtype == 'png') {
$image = $this->replaceTransparentWhite($this->im);
@imageJPEG($image);
} else {
@imageJPEG($this->im);
}
break;
case 'gif':
header("Content-type: image/gif");
@imageGIF($this->im);
break;
case 'png':
header("Content-type: image/png");
@imagePNG($this->im);
break;
case 'wbmp':
header("Content-type: image/vnd.wap.wbmp");
@imageWBMP($this->im);
break;
case 'swf':
header("Content-type: application/x-shockwave-flash");
$this->imageSWF($this->im);
break;
}
} else {
// Added Support vor different directory
if (DEFINED('V_TEMP_DIR')) {
$this->newimname = V_TEMP_DIR . $this->imname . '.' . $validtype;
} else {
$this->newimname = $this->imname . '.' . $validtype;
}
/* save the image */
switch ($validtype) {
case 'jpeg':
// Added jpe
// Added jpe
case 'jpe':
case 'jpg':
if ($this->imtype == 'gif' or $this->imtype == 'png') {
/* replace transparent with white */
$image = $this->replaceTransparentWhite($this->im);
@imageJPEG($image, $this->newimname);
} else {
@imageJPEG($this->im, $this->newimname);
}
break;
case 'gif':
@imageGIF($this->im, $this->newimname);
break;
case 'png':
@imagePNG($this->im, $this->newimname);
break;
case 'wbmp':
@imageWBMP($this->im, $this->newimname);
break;
case 'swf':
$this->imageSWF($this->im, $this->newimname);
break;
}
}
}