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


PHP ImageCreateFromPng函数代码示例

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


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

示例1: reldis_createFile

function reldis_createFile($filename, $uga_part, $agga_part)
{
    $im_uga = @ImageCreateFromPng("good.png");
    $im_agga = @ImageCreateFromPng("bad.png");
    if (!$im_uga || !$im_agga) {
        die("Cannot Initialize new GD image stream");
    }
    $width = imagesx($im_uga);
    $sum = $uga_part + $agga_part;
    $uga_part /= $sum;
    $agga_part /= $sum;
    $uga_part *= $width;
    $agga_part *= $width;
    $im = @ImageCreate($width, $width);
    $white = imagecolorallocate($im, 0xff, 0xff, 0xff);
    imagefill($im, 0, 0, $white);
    imagecolortransparent($im, $white);
    $left = 0;
    imagecopy($im, $im_uga, $left, 0, $left, 0, $uga_part + 1, $width);
    $left += $uga_part;
    imagecopy($im, $im_agga, $left, 0, $left, 0, $agga_part + 1, $width);
    header("Content-type: image/png");
    imagepng($im, $filename);
    imagedestroy($im);
}
开发者ID:norter,项目名称:Game,代码行数:25,代码来源:religious_distribution.php

示例2: get_hex

 function get_hex($location, $extensions = array('PNG', 'png', 'Png', 'JPG', 'jpg', 'Jpg', 'JPEG', 'jpeg', 'Jpeg', 'GIF', 'gif', 'Gif'), $postvar = "myimage", $getvar = "imgclix")
 {
     if (isset($_GET[$getvar])) {
         foreach ($extensions as $var) {
             if (file_exists($location . str_replace(array("..", ".", $var), '', html_entity_decode($_GET[$getvar])) . "." . $var)) {
                 if (stristr($var, 'png')) {
                     $im = ImageCreateFromPng($location . str_replace(array("..", ".", $var), '', html_entity_decode($_GET[$getvar])) . "." . $var);
                 } elseif (stristr($var, 'gif')) {
                     $im = ImageCreateFromGIF($location . str_replace(array("..", ".", $var), '', html_entity_decode($_GET[$getvar])) . "." . $var);
                 } elseif (stristr($var, 'jpg') || stristr($var, 'jpeg')) {
                     $im = ImageCreateFromJpeg($location . str_replace(array("..", ".", $var), '', html_entity_decode($_GET[$getvar])) . "." . $var);
                 } else {
                     return FALSE;
                 }
                 $rgb = ImageColorAt($im, $_POST[$postvar . '_x'], $_POST[$postvar . '_y']);
                 $rgb = imagecolorsforindex($im, $rgb);
                 $hex = sprintf('#%02X%02X%02X', $rgb['red'], $rgb['green'], $rgb['blue']);
                 break;
             }
         }
     } else {
         return FALSE;
     }
     if (!isset($hex) || $hex == '') {
         return FALSE;
     }
     return $hex;
 }
开发者ID:mndrwd,项目名称:freedomeditor,代码行数:28,代码来源:get_hex.php

示例3: pcs_href_image

 function pcs_href_image($src_path)
 {
     $strRet = DIR_WS_IMAGES . 'pcs_images/' . basename($src_path) . '_' . MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_HEIGHT . '_' . MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_WIDTH . '_' . MODULE_ADDONS_PCSLIDESHOW_IMAGE_QUALITY . '.jpg';
     #This will be the filename of the resized image.
     if (!file_exists($strRet)) {
         #Create the file if it does not exist
         #check to see if source file exists
         if (!file_exists($src_path)) {
             return 'error1';
             #check to see if source file is readable
         } elseif (!is_readable($src_path)) {
             return 'error2';
         }
         #check if gif
         if (stristr(strtolower($src_path), '.gif')) {
             $oldImage = ImageCreateFromGif($src_path);
         } elseif (stristr(strtolower($src_path), '.jpg') || stristr(strtolower($src_path), '.jpeg')) {
             $oldImage = ImageCreateFromJpeg($src_path);
         } elseif (stristr(strtolower($src_path), '.png')) {
             $oldImage = ImageCreateFromPng($src_path);
         } else {
             return 'error3';
         }
         #Create the new image
         if (function_exists("ImageCreateTrueColor")) {
             $newImage = ImageCreateTrueColor(MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_WIDTH, MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_HEIGHT);
         } else {
             $newImage = ImageCreate(MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_WIDTH, MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_HEIGHT);
         }
         $backgroundColor = imagecolorallocate($newImage, 255, 255, 255);
         imagefill($newImage, 0, 0, $backgroundColor);
         #calculate the rezised image's dimmensions
         if (imagesx($oldImage) > MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_WIDTH || imagesy($oldImage) > MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_HEIGHT) {
             #Resize image
             if (imagesx($oldImage) / MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_WIDTH > imagesy($oldImage) / MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_HEIGHT) {
                 #Width is leading in beeing to large
                 $newWidth = (int) MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_WIDTH;
                 $newHeight = (int) MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_WIDTH / imagesx($oldImage) * imagesy($oldImage);
             } else {
                 #Height is leading in beeing to large
                 $newHeight = (int) MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_HEIGHT;
                 $newWidth = (int) MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_HEIGHT / imagesy($oldImage) * imagesx($oldImage);
             }
         } else {
             #Don't rezise image
             $newWidth = imagesx($oldImage);
             $newHeight = imagesy($oldImage);
         }
         #Copy the old image onto the new image
         ImageCopyResampled($newImage, $oldImage, MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_WIDTH / 2 - $newWidth / 2, MODULE_ADDONS_PCSLIDESHOW_MAX_IMAGE_HEIGHT / 2 - $newHeight / 2, 0, 0, $newWidth, $newHeight, imagesx($oldImage), imagesy($oldImage));
         imagejpeg($newImage, $strRet, MODULE_ADDONS_PCSLIDESHOW_IMAGE_QUALITY);
         #save the image
         imagedestroy($oldImage);
         #Free Memory
         imagedestroy($newImage);
         #Free memory
     }
     return $strRet;
 }
开发者ID:resultsonlyweb,项目名称:loaded6-template,代码行数:59,代码来源:products_cycle_slideshow.php

示例4: controller_stitch

 function controller_stitch()
 {
     $basefile = "./htdocs/world.topo.bathy.200401.3x21600x21600";
     $combined = "./htdocs/big.png";
     $tilesize = array(21600, 21600);
     $finalimg = ImageCreateTrueColor($tilesize[0] * 2, $tilesize[1] * 1);
     $tiles["A1"] = ImageCreateFromPng($basefile . ".A1.png");
 }
开发者ID:ameyer430,项目名称:elation,代码行数:8,代码来源:supercritical_deepzoom.php

示例5: ResizeImage

function ResizeImage($Filename, $Thumbnail, $Size)
{
    $Path = pathinfo($Filename);
    $Extension = $Path['extension'];
    $ImageData = @GetImageSize($Filename);
    $Width = $ImageData[0];
    $Height = $ImageData[1];
    if ($Width >= $Height and $Width > $Size) {
        $NewWidth = $Size;
        $NewHeight = $Size / $Width * $Height;
    } elseif ($Height >= $Width and $Height > $Size) {
        $NewWidth = $Size / $Height * $Width;
        $NewHeight = $Size;
    } else {
        $NewWidth = $Width;
        $NewHeight = $Height;
    }
    $NewImage = @ImageCreateTrueColor($NewWidth, $NewHeight);
    if (preg_match('/^gif$/i', $Extension)) {
        $Image = @ImageCreateFromGif($Filename);
    } elseif (preg_match('/^png$/i', $Extension)) {
        $Image = @ImageCreateFromPng($Filename);
    } else {
        $Image = @ImageCreateFromJpeg($Filename);
    }
    if ($ImageData[2] == IMAGETYPE_GIF or $ImageData[2] == IMAGETYPE_PNG) {
        $TransIndex = imagecolortransparent($Image);
        // If we have a specific transparent color
        if ($TransIndex >= 0) {
            // Get the original image's transparent color's RGB values
            $TransColor = imagecolorsforindex($Image, $TransIndex);
            // Allocate the same color in the new image resource
            $TransIndex = imagecolorallocate($NewImage, $TransColor['red'], $TransColor['green'], $TransColor['blue']);
            // Completely fill the background of the new image with allocated color.
            imagefill($NewImage, 0, 0, $TransIndex);
            // Set the background color for new image to transparent
            imagecolortransparent($NewImage, $TransIndex);
        } elseif ($ImageData[2] == IMAGETYPE_PNG) {
            // Turn off transparency blending (temporarily)
            imagealphablending($NewImage, false);
            // Create a new transparent color for image
            $color = imagecolorallocatealpha($NewImage, 0, 0, 0, 127);
            // Completely fill the background of the new image with allocated color.
            imagefill($NewImage, 0, 0, $color);
            // Restore transparency blending
            imagesavealpha($NewImage, true);
        }
    }
    @ImageCopyResampled($NewImage, $Image, 0, 0, 0, 0, $NewWidth, $NewHeight, $Width, $Height);
    if (preg_match('/^gif$/i', $Extension)) {
        @ImageGif($NewImage, $Thumbnail);
    } elseif (preg_match('/^png$/i', $Extension)) {
        @ImagePng($NewImage, $Thumbnail);
    } else {
        @ImageJpeg($NewImage, $Thumbnail);
    }
    @chmod($Thumbnail, 0644);
}
开发者ID:kelsh,项目名称:classic,代码行数:58,代码来源:notgallery.php

示例6: createFromFile

 public static function createFromFile($filename, $mime_type, $objAlbum)
 {
     $objPicture = new clsPicture();
     /* Decide which incoming mime type it is. */
     switch ($mime_type) {
         case 'image/jpeg':
             $img = ImageCreateFromJpeg($filename);
             break;
         case 'image/png':
             $img = ImageCreateFromPng($filename);
             break;
         case 'image/gif':
             $img = ImageCreateFromGif($filename);
             break;
         default:
             return 'image_filetype';
     }
     list($intWidth, $intHeight) = getImageSize($filename);
     $intMaxWidth = $objAlbum->get('max_width');
     $intMaxHeight = $objAlbum->get('max_height');
     if ($intMaxWidth <= 0) {
         $intMaxWidth = DEFAULT_X;
     }
     if ($intMaxHeight <= 0) {
         $intMaxHeight = DEFAULT_Y;
     }
     if ($intWidth > $intMaxWidth || $intHeight > $intMaxHeight) {
         /* Check whether the image needs to be resized vertically or horizonally more. */
         if ($intWidth / $intMaxWidth > $intHeight / $intMaxHeight) {
             /* Right-left needs to have priority. */
             $ratio = $intMaxWidth / $intWidth;
         } else {
             /* Up-down needs to have priority. */
             $ratio = $intMaxHeight / $intHeight;
         }
         $intNewWidth = $intWidth * $ratio;
         $intNewHeight = $intHeight * $ratio;
         $imgNew = @ImageCreateTrueColor($intNewWidth, $intNewHeight);
         if (!@ImageCopyResized($imgNew, $img, 0, 0, 0, 0, $intNewWidth, $intNewHeight, $intWidth, $intHeight)) {
             return "image_noresize";
         }
         $intWidth = $intNewWidth;
         $intHeight = $intNewHeight;
         ImageDestroy($img);
         $img = $imgNew;
     }
     /* This has to be done before setImage() because setImage() needs data from the album. */
     $objPicture->set('album_id', $objAlbum->get('id'));
     $result = $objPicture->setImage($img);
     ImageDestroy($img);
     if ($result) {
         return $result;
     }
     $objPicture->set('width', $intWidth);
     $objPicture->set('height', $intHeight);
     $objPicture->save();
     return $objPicture;
 }
开发者ID:shifter,项目名称:ospap2,代码行数:58,代码来源:clsPicture.php

示例7: CreatePngThumbnail

 public static function CreatePngThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbWidth, $imageNewName)
 {
     $srcImg = ImageCreateFromPng($imageDirectory . $imageName);
     $origWidth = imagesx($srcImg);
     $origHeight = imagesy($srcImg);
     $ratio = $thumbWidth / $origWidth;
     $thumbHeight = $origHeight * $ratio;
     $thumbImg = imagecreatetruecolor($thumbWidth, $thumbHeight);
     imagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0, $thumbWidth, $thumbHeight, imagesx($srcImg), imagesy($srcImg));
     imagePng($thumbImg, $thumbDirectory . $imageNewName);
 }
开发者ID:brandfeverinc,项目名称:coke-cooler,代码行数:11,代码来源:Helpers.php

示例8: Bouton

 function Bouton($alt, $image, $police, $taille_police, $hex_bgc, $x, $y, $degre, $cache, $theme)
 {
     // on cherche le repertoire ou se trouve les boutons
     if (is_dir('themes/' . $theme . '/images/')) {
         $rep = 'themes/' . $theme . '/images/';
     } else {
         $rep = 'tools/templates/themes/' . $theme . '/images/';
     }
     $this->alt = $alt;
     $this->nom = 'cache/bouton_' . str_replace('.png', '', $image) . '_' . $this->formater($alt) . '.png';
     if (is_file($this->nom) && !empty($cache)) {
         $taille = getimagesize($this->nom);
         $this->largeur = $taille[0];
         $this->hauteur = $taille[1];
     } else {
         // Utilisation des ressources graphiques
         $fond = $rep . $image;
         $taille_fond = getimagesize($fond);
         $img = ImageCreateFromPng($fond);
         // Parametres du bouton
         $this->hauteur = $taille_fond[1];
         $this->largeur = $taille_fond[0];
         // On formate la couleur comme il faut
         $hex_bgc = str_replace('#', '', $hex_bgc);
         switch (strlen($hex_bgc)) {
             case 6:
                 $red = hexdec(substr($hex_bgc, 0, 2));
                 $green = hexdec(substr($hex_bgc, 2, 2));
                 $blue = hexdec(substr($hex_bgc, 4, 2));
                 break;
             case 3:
                 $red = substr($hex_bgc, 0, 1);
                 $green = substr($hex_bgc, 1, 1);
                 $blue = substr($hex_bgc, 2, 1);
                 $red = hexdec($red . $red);
                 $green = hexdec($green . $green);
                 $blue = hexdec($blue . $blue);
                 break;
             default:
                 //	mauvaises valeurs, on met en noir
                 $red = 0;
                 $green = 0;
                 $blue = 0;
         }
         $couleur = ImageColorAllocate($img, $red, $green, $blue);
         // Texte
         imagettftext($img, $taille_police, $degre, $x, $y, $couleur, $rep . $police, ' ' . stripslashes(trim($this->alt)));
         imagealphablending($img, true);
         imagesavealpha($img, true);
         //Creation du bouton de type btn_[motif]_[alt].png
         imagepng($img, $this->nom);
     }
 }
开发者ID:BackupTheBerlios,项目名称:wikiplug,代码行数:53,代码来源:bouton.php

示例9: img_resizer

 private static function img_resizer($src, $quality, $w, $h, $saveas)
 {
     /* v2.5 with auto crop */
     $r = 1;
     $e = strtolower(substr($src, strrpos($src, ".") + 1, 3));
     if ($e == "jpg" || $e == "jpeg") {
         $OldImage = imagecreatefromjpeg($src) or $r = 0;
     } elseif ($e == "gif") {
         $OldImage = ImageCreateFromGif($src) or $r = 0;
     } elseif ($e == "bmp") {
         $OldImage = ImageCreateFromwbmp($src) or $r = 0;
     } elseif ($e == "png") {
         $OldImage = ImageCreateFromPng($src) or $r = 0;
     } else {
         _o("No es una imagen v&aacute;lida! (" . $e . ") -- " . $src);
         $r = 0;
     }
     if ($r) {
         list($width, $height) = getimagesize($src);
         // check if ratios match
         $_ratio = array($width / $height, $w / $h);
         if ($_ratio[0] != $_ratio[1]) {
             // crop image
             // find the right scale to use
             $_scale = min((double) ($width / $w), (double) ($height / $h));
             // coords to crop
             $cropX = (double) ($width - $_scale * $w);
             $cropY = (double) ($height - $_scale * $h);
             // cropped image size
             $cropW = (double) ($width - $cropX);
             $cropH = (double) ($height - $cropY);
             $crop = ImageCreateTrueColor($cropW, $cropH);
             // crop the middle part of the image to fit proportions
             ImageCopy($crop, $OldImage, 0, 0, (int) ($cropX / 2), (int) ($cropY / 2), $cropW, $cropH);
         }
         // do the thumbnail
         $NewThumb = ImageCreateTrueColor($w, $h);
         if (isset($crop)) {
             // been cropped
             ImageCopyResampled($NewThumb, $crop, 0, 0, 0, 0, $w, $h, $cropW, $cropH);
             ImageDestroy($crop);
         } else {
             // ratio match, regular resize
             ImageCopyResampled($NewThumb, $OldImage, 0, 0, 0, 0, $w, $h, $width, $height);
         }
         _ckdir($saveas);
         ImageJpeg($NewThumb, $saveas, $quality);
         ImageDestroy($NewThumb);
         ImageDestroy($OldImage);
     }
     return $r;
 }
开发者ID:neruruguay,项目名称:neru,代码行数:52,代码来源:List_Files.php

示例10: createimageByType

 private function createimageByType($data, $file)
 {
     if ($data['type'] === "image/jpeg") {
         $image = ImageCreateFromJpeg($file);
     }
     if ($data['type'] === "image/png") {
         $image = ImageCreateFromPng($file);
     }
     if ($data['type'] === "image/gif") {
         $image = ImageCreateFromGif($file);
     }
     return $image;
 }
开发者ID:korzhevdp,项目名称:freehand,代码行数:13,代码来源:upload.php

示例11: create_image_container

 private function create_image_container($file, $type)
 {
     $path = $this->config->item("upload_dir");
     if (strtolower($type) === ".jpg" || strtolower($type) === ".jpeg") {
         $image = ImageCreateFromJpeg($path . $file . $type);
     } elseif (strtolower($type) === ".png") {
         $image = ImageCreateFromPng($path . $file . $type);
     } elseif (strtolower($type) === ".gif") {
         $image = ImageCreateFromGif($path . $file . $type);
     } else {
         $image = false;
     }
     return $image;
 }
开发者ID:korzhevdp,项目名称:MiniGIS,代码行数:14,代码来源:uploadmodel.php

示例12: likebanner_init

function likebanner_init(&$a)
{
    if (argc() > 1 && argv(1) == 'show' && $_REQUEST['addr']) {
        header("Content-Type: image/png");
        $im = ImageCreateFromPng('addon/likebanner/like_banner.png');
        $black = ImageColorAllocate($im, 0, 0, 0);
        $start_x = 18;
        $start_y = 110;
        $fontsize = $_REQUEST['size'] ? intval($_REQUEST['size']) : 28;
        imagettftext($im, $fontsize, 0, $start_x, $start_y, $black, 'addon/likebanner/FreeSansBold.ttf', $_REQUEST['addr']);
        imagepng($im);
        ImageDestroy($im);
        killme();
    }
}
开发者ID:einervonvielen,项目名称:redmatrix-addons,代码行数:15,代码来源:likebanner.php

示例13: image_resize

function image_resize($upfile, $output_filename, $output_path, $dst_w = 100, $dst_h = 100, $isRadio = 1, $trans_color = array(254, 254, 254))
{
    $imagedata = GetImageSize($upfile);
    // Read the size
    $src_w = $imagedata[0];
    $src_h = $imagedata[1];
    $src_type = $imagedata[2];
    $re_dst_x = 0;
    $re_dst_y = 0;
    if ($isRadio | 0 > 0) {
        if ($dst_w >= $src_w && $dst_h >= $src_h) {
            $re_dst_w = $src_w;
            $re_dst_h = $src_h;
        } else {
            $p_w = $dst_w / $src_w;
            $p_h = $dst_h / $src_h;
            $p = min($p_w, $p_h);
            $re_dst_w = $src_w * $p;
            $re_dst_h = $src_h * $p;
        }
    } else {
        $re_dst_w = $dst_w;
        $re_dst_h = $dst_h;
    }
    if ($src_type == 1) {
        $src_image = ImageCreateFromGif($upfile);
    } else {
        if ($src_type == 2) {
            $src_image = ImageCreateFromJpeg($upfile);
        } else {
            if ($src_type == 3) {
                $src_image = ImageCreateFromPng($upfile);
            } else {
                if ($src_type == 16) {
                    $src_image = imagecreatefromxbm($upfile);
                }
            }
        }
    }
    //else if ($src_type==6)
    //	return;
    $dst_image = imagecreatetruecolor($re_dst_w, $re_dst_h);
    $bgc = imagecolorallocate($dst_image, $trans_color[0], $trans_color[1], $trans_color[2]);
    imagefilledrectangle($dst_image, 0, 0, $re_dst_w, $re_dst_h, $bgc);
    imagecolortransparent($dst_image, $bgc);
    imagecopyresampled($dst_image, $src_image, $re_dst_x, $re_dst_y, 0, 0, $re_dst_w, $re_dst_h, $src_w, $src_h);
    imagepng($dst_image, $output_path . $output_filename);
}
开发者ID:hardy419,项目名称:2015-7-27,代码行数:48,代码来源:lib_img_resize.php

示例14: getImage

 private function getImage($imageUrl)
 {
     if (!file_get_contents($imageUrl)) {
         throw new \Exception("Image not found");
     }
     $ext = strtolower(array_pop(explode('.', $imageUrl)));
     if ($ext == "jpeg" || $ext == "jpg") {
         return ImageCreateFromJpeg($imageUrl);
     } elseif ($ext == "gif") {
         return ImageCreateFromGif($imageUrl);
     } elseif ($ext == "png") {
         return ImageCreateFromPng($imageUrl);
     } else {
         throw new \Exception("Image not supported");
     }
 }
开发者ID:MichalKatuscak,项目名称:FontColorByImage,代码行数:16,代码来源:FontColorByImage.class.php

示例15: action_index

 public function action_index()
 {
     // Remove an image
     if (isset($_GET['rm'])) {
         $image = new Content_Image($_GET['rm']);
         $image->rm_image();
         $this->redirect();
     }
     // Add image
     if (isset($_POST['upload_image'])) {
         foreach ($_FILES['image']['name'] as $nr => $name) {
             if ($name != '') {
                 $pathinfo = pathinfo($_FILES['image']['name'][$nr]);
                 if (strtolower($pathinfo['extension']) == 'jpg' || strtolower($pathinfo['extension']) == 'png') {
                     $filename = 'frontimage.' . strtolower($pathinfo['extension']);
                     $new_filename = $filename;
                     $counter = 1;
                     while (!Content_Image::image_name_available($new_filename)) {
                         $new_filename = substr($filename, 0, strlen($filename) - 4) . '_' . $counter . '.' . strtolower($pathinfo['extension']);
                         $counter++;
                     }
                     if (move_uploaded_file($_FILES['image']['tmp_name'][$nr], APPPATH . '/user_content/images/' . $new_filename)) {
                         if (strtolower($pathinfo['extension']) == 'jpg') {
                             $gd_img_object = ImageCreateFromJpeg(Kohana::$config->load('user_content.dir') . '/images/' . $new_filename);
                         } elseif (strtolower($pathinfo['extension']) == 'png') {
                             $gd_img_object = ImageCreateFromPng(Kohana::$config->load('user_content.dir') . '/images/' . $new_filename);
                         }
                         $details = array('width' => array(imagesx($gd_img_object)), 'height' => array(imagesy($gd_img_object)), 'frontimage' => NULL);
                         Content_Image::new_image($new_filename, $details);
                     } else {
                         $this->add_error('Unknown error uploading image(s)');
                     }
                 }
             }
         }
     }
     // Images
     $images = array();
     foreach (Content_image::get_images(NULL, array('frontimage' => TRUE)) as $image_name => $image_data) {
         $images[] = array('name' => $image_name);
     }
     $this->xml_content_images = $this->xml_content->appendChild($this->dom->createElement('images'));
     xml::to_XML($images, $this->xml_content_images, 'image');
 }
开发者ID:rockymontana,项目名称:Pajas-Gallery,代码行数:44,代码来源:frontimages.php


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