• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP imageCopyResized函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: thumbnail

function thumbnail($PicPathIn, $PicPathOut, $PicFilenameIn, $PicFilenameOut, $neueHoehe, $Quality)
{
    // Bilddaten ermitteln
    $size = getimagesize("{$PicPathIn}" . "{$PicFilenameIn}");
    $breite = $size[0];
    $hoehe = $size[1];
    $neueBreite = intval($breite * $neueHoehe / $hoehe);
    if ($size[2] == 1) {
        // GIF
        $altesBild = ImageCreateFromGIF("{$PicPathIn}" . "{$PicFilenameIn}");
        $neuesBild = imageCreateTrueColor($neueBreite, $neueHoehe);
        imageCopyResized($neuesBild, $altesBild, 0, 0, 0, 0, $neueBreite, $neueHoehe, $breite, $hoehe);
        imageJPEG($neuesBild, "{$PicPathOut}" . "{$PicFilenameOut}", $Quality);
    }
    if ($size[2] == 2) {
        // JPG
        $altesBild = ImageCreateFromJPEG("{$PicPathIn}" . "{$PicFilenameIn}");
        $neuesBild = imageCreateTrueColor($neueBreite, $neueHoehe);
        imageCopyResized($neuesBild, $altesBild, 0, 0, 0, 0, $neueBreite, $neueHoehe, $breite, $hoehe);
        ImageJPEG($neuesBild, "{$PicPathOut}" . "{$PicFilenameOut}", $Quality);
    }
    if ($size[2] == 3) {
        // PNG
        $altesBild = ImageCreateFromPNG("{$PicPathIn}" . "{$PicFilenameIn}");
        $neuesBild = imageCreateTrueColor($neueBreite, $neueHoehe);
        imageCopyResized($neuesBild, $altesBild, 0, 0, 0, 0, $neueBreite, $neueHoehe, $breite, $hoehe);
        ImageJPEG($neuesBild, "{$PicPathOut}" . "{$PicFilenameOut}", $Quality);
    }
}
开发者ID:nchiapol,项目名称:ecamp,代码行数:29,代码来源:action_save_change_avatar.php


示例2: writeCopy

 function writeCopy($filename, $width, $height) {
          if($this->isLoaded()) {
              $imageNew = imageCreate($width, $height);
              if(!$imageNew) {
                  echo "ERREUR : Nouvelle image non créée";
              }
              imageCopyResized($imageNew, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);
              imageJpeg($imageNew, $filename);
          }
 }
开发者ID:nidtropical,项目名称:nidtropical_old,代码行数:10,代码来源:index.php


示例3: Resize

 function Resize($maxwidth = 10000, $maxheight, $imagename, $filetype, $how = 'keep_aspect')
 {
     $target_temp_file = tempnam("jinn/temp", "gdlib_");
     unlink($target_temp_file);
     $target_temp_file .= '.' . $filetype;
     if (!$maxheight) {
         $maxheight = 10000;
     }
     if (!$maxwidth) {
         $maxwidth = 10000;
     }
     $qual = 100;
     $filename = $imagename;
     $ext = $filetype;
     list($curwidth, $curheight) = getimagesize($filename);
     $factor = min($maxwidth / $curwidth, $maxheight / $curheight);
     $sx = 0;
     $sy = 0;
     $sw = $curwidth;
     $sh = $curheight;
     $dx = 0;
     $dy = 0;
     $dw = $curwidth * $factor;
     $dh = $curheight * $factor;
     if ($ext == "JPEG") {
         $src = ImageCreateFromJPEG($filename);
     }
     if ($ext == "GIF") {
         $src = ImageCreateFromGIF($filename);
     }
     if ($ext == "PNG") {
         $src = ImageCreateFromPNG($filename);
     }
     if (function_exists('ImageCreateTrueColor')) {
         $dst = ImageCreateTrueColor($dw, $dh);
     } else {
         $dst = ImageCreate($dw, $dh);
     }
     if (function_exists('ImageCopyResampled')) {
         imageCopyResampled($dst, $src, $dx, $dy, $sx, $sy, $dw, $dh, $sw, $sh);
     } else {
         imageCopyResized($dst, $src, $dx, $dy, $sx, $sy, $dw, $dh, $sw, $sh);
     }
     if ($ext == "JPEG") {
         ImageJPEG($dst, $target_temp_file, $qual);
     }
     if ($ext == "PNG") {
         ImagePNG($dst, $target_temp_file, $qual);
     }
     if ($ext == "GIF") {
         ImagePNG($dst, $target_temp_file, $qual);
     }
     ImageDestroy($dst);
     return $target_temp_file;
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:55,代码来源:class.bogdlib.inc.php


示例4: create_avatar

function create_avatar($imgpath, $thumbpath, $neueBreite, $neueHoehe)
{
    $size = getimagesize($imgpath);
    $breite = $size[0];
    $hoehe = $size[1];
    $RatioW = $neueBreite / $breite;
    $RatioH = $neueHoehe / $hoehe;
    if ($RatioW < $RatioH) {
        $neueBreite = $breite * $RatioW;
        $neueHoehe = $hoehe * $RatioW;
    } else {
        $neueBreite = $breite * $RatioH;
        $neueHoehe = $hoehe * $RatioH;
    }
    $neueBreite = round($neueBreite, 0);
    $neueHoehe = round($neueHoehe, 0);
    if (function_exists('gd_info')) {
        $tmp = gd_info();
        $imgsup = $tmp['GIF Create Support'] ? 1 : 2;
        unset($tmp);
    } else {
        $imgsup = 2;
    }
    if ($size[2] < $imgsup or $size[2] > 3) {
        return false;
    }
    if ($size[2] == 1) {
        $altesBild = imagecreatefromgif($imgpath);
    } elseif ($size[2] == 2) {
        $altesBild = imagecreatefromjpeg($imgpath);
    } elseif ($size[2] == 3) {
        $altesBild = imagecreatefrompng($imgpath);
    }
    if (function_exists('imagecreatetruecolor') and $size[2] != 1) {
        $neuesBild = png_create_transparent($neueBreite, $neueHoehe);
        imagecopyresampled($neuesBild, $altesBild, 0, 0, 0, 0, $neueBreite, $neueHoehe, $breite, $hoehe);
    } elseif (function_exists('imagecreatetruecolor') and $size[2] == 1) {
        $neuesBild = imageCreate($neueBreite, $neueHoehe);
        gif_create_transparent($neuesBild, $altesBild);
        imagecopyresampled($neuesBild, $altesBild, 0, 0, 0, 0, $neueBreite, $neueHoehe, $breite, $hoehe);
    } else {
        $neuesBild = imageCreate($neueBreite, $neueHoehe);
        imageCopyResized($neuesBild, $altesBild, 0, 0, 0, 0, $neueBreite, $neueHoehe, $breite, $hoehe);
    }
    if ($size[2] == 1) {
        ImageGIF($neuesBild, $thumbpath);
    } elseif ($size[2] == 2) {
        ImageJPEG($neuesBild, $thumbpath);
    } elseif ($size[2] == 3) {
        ImagePNG($neuesBild, $thumbpath);
    }
    return true;
}
开发者ID:rjdesign,项目名称:Ilch-1.2,代码行数:53,代码来源:profile_image.php


示例5: __resize

 /**
  * Do the actual resize of an image
  *
  * @param Asido_TMP &$tmp
  * @param integer $width
  * @param integer $height
  * @return boolean
  * @access protected
  */
 function __resize(&$tmp, $width, $height)
 {
     // create new target
     //
     $_ = imageCreateTrueColor($width, $height);
     imageSaveAlpha($_, true);
     imageAlphaBlending($_, false);
     $r = imageCopyResized($_, $tmp->target, 0, 0, 0, 0, $width, $height, $tmp->image_width, $tmp->image_height);
     // set new target
     //
     $this->__destroy_target($tmp);
     $tmp->target = $_;
     return $r;
 }
开发者ID:networksoft,项目名称:networksoft.com.co,代码行数:23,代码来源:class.driver.gd.php


示例6: create_thumb

function create_thumb($imgpath, $thumbpath, $neueBreite)
{
    $size = getimagesize($imgpath);
    $breite = $size[0];
    $hoehe = $size[1];
    $neueHoehe = intval($hoehe * $neueBreite / $breite);
    if (function_exists('gd_info')) {
        $tmp = gd_info();
        $imgsup = $tmp['GIF Create Support'] ? 1 : 2;
        unset($tmp);
    } else {
        $imgsup = 2;
    }
    if ($size[2] < $imgsup or $size[2] > 3) {
        return FALSE;
    }
    if ($size[2] == 1) {
        $altesBild = imagecreatefromgif($imgpath);
    } elseif ($size[2] == 2) {
        $altesBild = imagecreatefromjpeg($imgpath);
    } elseif ($size[2] == 3) {
        $altesBild = imagecreatefrompng($imgpath);
    }
    if (function_exists('imagecreatetruecolor') and $size[2] != 1) {
        $neuesBild = imagecreatetruecolor($neueBreite, $neueHoehe);
        imagecopyresampled($neuesBild, $altesBild, 0, 0, 0, 0, $neueBreite, $neueHoehe, $breite, $hoehe);
    } else {
        $neuesBild = imageCreate($neueBreite, $neueHoehe);
        imageCopyResized($neuesBild, $altesBild, 0, 0, 0, 0, $neueBreite, $neueHoehe, $breite, $hoehe);
    }
    if ($size[2] == 1) {
        ImageGIF($neuesBild, $thumbpath);
    } elseif ($size[2] == 2) {
        ImageJPEG($neuesBild, $thumbpath);
    } elseif ($size[2] == 3) {
        ImagePNG($neuesBild, $thumbpath);
    }
    return TRUE;
}
开发者ID:kveldscholten,项目名称:Ilch-1.1,代码行数:39,代码来源:gallery.php


示例7: CreatThumb

 public function CreatThumb($filetype, $tsrc, $dest, $n_width, $n_height)
 {
     if ($filetype == "gif") {
         $im = ImageCreateFromGIF($dest);
         // Original picture width is stored
         $width = ImageSx($im);
         // Original picture height is stored
         $height = ImageSy($im);
         $newimage = imagecreatetruecolor($n_width, $n_height);
         imageCopyResized($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height);
         ImageGIF($newimage, $tsrc);
         chmod("{$tsrc}", 0755);
     }
     if ($filetype == "jpg") {
         $im = ImageCreateFromJPEG($dest);
         // Original picture width is stored
         $width = ImageSx($im);
         // Original picture height is stored
         $height = ImageSy($im);
         $newimage = imagecreatetruecolor($n_width, $n_height);
         imageCopyResized($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height);
         ImageJpeg($newimage, $tsrc);
         chmod("{$tsrc}", 0755);
     }
     if ($filetype == "png") {
         $im = ImageCreateFromPNG($dest);
         // Original picture width is stored
         $width = ImageSx($im);
         // Original picture height is stored
         $height = ImageSy($im);
         $newimage = imagecreatetruecolor($n_width, $n_height);
         imageCopyResized($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height);
         imagepng($newimage, $tsrc);
         chmod("{$tsrc}", 0755);
     }
 }
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:36,代码来源:thumbnail.php


示例8: copyResource

 /**
  * Copy an existing internal image resource, or part of it, to this Image instance
  * @param resource existing internal image resource as source for the copy
  * @param int x x-coordinate where the copy starts
  * @param int y y-coordinate where the copy starts
  * @param int resourceX starting x coordinate of the source image resource
  * @param int resourceY starting y coordinate of the source image resource
  * @param int width resulting width of the copy (not of the resulting image)
  * @param int height resulting height of the copy (not of the resulting image)
  * @param int resourceWidth width of the source image resource to copy
  * @param int resourceHeight height of the source image resource to copy
  * @return null
  */
 protected function copyResource($resource, $x, $y, $resourceX, $resourceY, $width, $height, $resourceWidth, $resourceHeight)
 {
     if (!imageCopyResampled($this->resource, $resource, $x, $y, $resourceX, $resourceY, $width, $height, $resourceWidth, $resourceHeight)) {
         if (!imageCopyResized($this->resource, $resource, $x, $y, $resourceX, $resourceY, $width, $height, $resourceWidth, $resourceHeight)) {
             throw new ImageException('Could not copy the image resource');
         }
     }
     $transparent = imageColorAllocate($this->resource, 0, 0, 0);
     imageColorTransparent($this->resource, $transparent);
     $this->width = $width;
     $this->height = $height;
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:25,代码来源:Image.php


示例9: geraFotos

 function geraFotos($fotoOriginal)
 {
     if (!file_exists($fotoOriginal)) {
         return;
     }
     list($imagewidth, $imageheight, $img_type) = @GetImageSize($fotoOriginal);
     $src_img_original = '';
     $fim_largura = $imagewidth;
     $fim_altura = $imageheight;
     $extensao = $img_type == 2 ? '.jpg' : ($img_type == 3 ? '.png' : '');
     $nome_do_arquivo = array_pop(explode('/', $fotoOriginal)) . $extensao;
     $caminhoDaBig = 'arquivos/educar/aluno/big/' . $nome_do_arquivo;
     $caminhoDaFotoOriginal = 'arquivos/educar/aluno/original/' . $nome_do_arquivo;
     if ($imagewidth > 700) {
         $new_w = 700;
         $ratio = $imagewidth / $new_w;
         $new_h = ceil($imageheight / $ratio);
         $fim_largura = $new_w;
         $fim_altura = $new_h;
         if (!file_exists($caminhoDaBig)) {
             if ($img_type == 2) {
                 $src_img_original = @imagecreatefromjpeg($fotoOriginal);
                 $dst_img = @imagecreatetruecolor($new_w, $new_h);
                 imagecopyresized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, imagesx($src_img_original), imagesy($src_img_original));
                 imagejpeg($dst_img, $caminhoDaBig);
             } elseif ($img_type == 3) {
                 $src_img_original = @ImageCreateFrompng($fotoOriginal);
                 $dst_img = @imagecreatetruecolor($new_w, $new_h);
                 ImageCopyResized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, ImageSX($src_img_original), ImageSY($src_img_original));
                 Imagepng($dst_img, $caminhoDaBig);
             }
         }
     } else {
         if (!file_exists($caminhoDaBig)) {
             copy($fotoOriginal, $caminhoDaBig);
             if ($img_type == 2) {
                 $src_img_original = @imagecreatefromjpeg($fotoOriginal);
             } elseif ($img_type == 3) {
                 $src_img_original = @imagecreatefrompng($fotoOriginal);
             }
         }
     }
     $new_w = 100;
     $ratio = $imagewidth / $new_w;
     $new_h = round($imageheight / $ratio);
     $caminhoDaSmall = 'arquivos/educar/aluno/small/' . $nome_do_arquivo;
     if (file_exists($caminhoDaBig)) {
         if ($img_type == 2) {
             $dst_img = @imagecreatetruecolor($new_w, $new_h);
             @imagecopyresized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, imagesx($src_img_original), imagesy($src_img_original));
             @imagejpeg($dst_img, $caminhoDaSmall);
         } elseif ($img_type == 3) {
             $dst_img = @imagecreatetruecolor($new_w, $new_h);
             @imageCopyResized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, ImageSX($src_img_original), imageSY($src_img_original));
             @imagepng($dst_img, $caminhoDaSmall);
         } elseif ($img_type == 1) {
             $dst_img = @imagecreatefromgif($src_img_original);
             @imageCopyResized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, ImageSX($src_img_original), imageSY($src_img_original));
             @imagegif($dst_img, $caminhoDaSmall);
         }
     }
     copy($fotoOriginal, $caminhoDaFotoOriginal);
     if (!(file_exists($fotoOriginal) && file_exists($caminhoDaSmall) && file_exists($caminhoDaBig))) {
         die("<center><br>Um erro ocorreu ao inserir a foto.<br>Por favor tente novamente.</center>");
     }
     if (file_exists($fotoOriginal)) {
         unlink($fotoOriginal);
     }
     return $nome_do_arquivo;
 }
开发者ID:eritter-ti,项目名称:ieducar,代码行数:70,代码来源:educar_aluno_cad.php


示例10: imagefill

imagefill($im_resized, 0, 0, $white_color);
$old_w = imagesx($im);
$old_h = imagesy($im);
$old_rate = $old_w / $old_h;
if ($old_rate == $new_rate) {
    imageCopyResized($im_resized, $im, 0, 0, 0, 0, $w, $h, $old_w, $old_h);
} else {
    if ($old_w > $old_h) {
        $tmp_h = $h;
        $tmp_w = $tmp_h * $old_rate;
        $tmp_im = imageCreate($tmp_w, $tmp_h);
        $white_color = imagecolorallocate($tmp_im, 255, 255, 255);
        imagefill($tmp_im, 0, 0, $white_color);
        imageCopyResized($tmp_im, $im, 0, 0, 0, 0, $tmp_w, $tmp_h, $old_w, $old_h);
        imageCopyResized($im_resized, $tmp_im, 0, 0, round(($tmp_w - $w) / 2), 0, $w, $h, $w, $h);
        imagedestroy($tmp_im);
    } else {
        $tmp_w = $w;
        $tmp_h = $tmp_w / $old_rate;
        $tmp_im = imageCreate($tmp_w, $tmp_h);
        $white_color = imagecolorallocate($tmp_im, 255, 255, 255);
        imagefill($tmp_im, 0, 0, $white_color);
        imageCopyResized($tmp_im, $im, 0, 0, 0, 0, $tmp_w, $tmp_h, $old_w, $old_h);
        imageCopyResized($im_resized, $tmp_im, 0, 0, 0, round(($tmp_h - $h) / 2), $w, $h, $w, $h);
        imagedestroy($tmp_im);
    }
}
header('Content-Type: image/jpeg');
imagejpeg($im_resized);
imagedestroy($im);
imagedestroy($im_resized);
开发者ID:azone,项目名称:General-Projects,代码行数:31,代码来源:resize_img.php


示例11: Novo

 function Novo()
 {
     global $HTTP_POST_FILES;
     if (!empty($HTTP_POST_FILES['foto']['name'])) {
         $fotoOriginal = "tmp/" . $HTTP_POST_FILES['foto']['name'];
         if (file_exists($fotoOriginal)) {
             unlink($fotoOriginal);
         }
         copy($HTTP_POST_FILES['foto']['tmp_name'], $fotoOriginal);
         list($imagewidth, $imageheight, $img_type) = getImageSize($fotoOriginal);
         $src_img_original = "";
         $fim_largura = $imagewidth;
         $fim_altura = $imageheight;
         $extensao = $img_type == "2" ? ".jpg" : ($img_type == "3" ? ".png" : "");
         $nome_do_arquivo = date('Y-m-d-h-i') . "-" . substr(md5($fotoOriginal), 0, 10) . $extensao;
         $caminhoDaBig = "fotos/big/{$nome_do_arquivo}";
         $caminhoDaSBig = "fotos/sbig/{$nome_do_arquivo}";
         if ($imagewidth > 700 && $imageheight < $imagewidth) {
             $new_w = 500;
             $ratio = $imagewidth / $new_w;
             $new_h = ceil($imageheight / $ratio);
             if (!file_exists($caminhoDaBig)) {
                 if ($img_type == "2") {
                     $src_img_original = imagecreatefromjpeg($fotoOriginal);
                     $dst_img = imagecreatetruecolor($new_w, $new_h);
                     imagecopyresized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, imagesx($src_img_original), imagesy($src_img_original));
                     imagejpeg($dst_img, $caminhoDaBig);
                 } else {
                     if ($img_type == "3") {
                         $src_img_original = @ImageCreateFrompng($fotoOriginal);
                         $dst_img = @imagecreatetruecolor($new_w, $new_h);
                         ImageCopyResized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, ImageSX($src_img_original), ImageSY($src_img_original));
                         Imagepng($dst_img, $caminhoDaBig);
                     }
                 }
             }
         } elseif ($imagewidth > 400 && $imageheight > $imagewidth) {
             $new_w = 400;
             $ratio = $imagewidth / $new_w;
             $new_h = ceil($imageheight / $ratio);
             $fim_largura = $new_w;
             $fim_altura = $new_h;
             if (!file_exists($caminhoDaBig)) {
                 if ($img_type == "2") {
                     $src_img_original = @imagecreatefromjpeg($fotoOriginal);
                     $dst_img = @imagecreatetruecolor($new_w, $new_h);
                     imagecopyresized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, imagesx($src_img_original), imagesy($src_img_original));
                     imagejpeg($dst_img, $caminhoDaBig);
                 } else {
                     if ($img_type == "3") {
                         $src_img_original = @ImageCreateFrompng($fotoOriginal);
                         $dst_img = @imagecreatetruecolor($new_w, $new_h);
                         ImageCopyResized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, ImageSX($src_img_original), ImageSY($src_img_original));
                         Imagepng($dst_img, $caminhoDaBig);
                     }
                 }
             }
         } else {
             if (!file_exists($caminhoDaBig)) {
                 copy($fotoOriginal, $caminhoDaBig);
                 if ($img_type == "2") {
                     $src_img_original = @imagecreatefromjpeg($fotoOriginal);
                 } else {
                     if ($img_type == "3") {
                         $src_img_original = @imagecreatefrompng($fotoOriginal);
                     }
                 }
             }
         }
         $new_w = 100;
         $ratio = $imagewidth / $new_w;
         $new_h = round($imageheight / $ratio);
         $caminhoDaSmall = "fotos/small/{$nome_do_arquivo}";
         if (!file_exists($caminhoDaSmall)) {
             if ($img_type == "2") {
                 $dst_img = @imagecreatetruecolor($new_w, $new_h);
                 @imagecopyresized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, imagesx($src_img_original), imagesy($src_img_original));
                 @imagejpeg($dst_img, $caminhoDaSmall);
             } else {
                 if ($img_type == "3") {
                     $dst_img = @imagecreatetruecolor($new_w, $new_h);
                     @imageCopyResized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, ImageSX($src_img_original), imageSY($src_img_original));
                     @imagepng($dst_img, $caminhoDaSmall);
                 }
             }
         }
         copy($fotoOriginal, $caminhoDaSBig);
         if (!(file_exists($fotoOriginal) && file_exists($caminhoDaSmall) && file_exists($caminhoDaBig))) {
             die("<center><br>Um erro ocorreu ao inserir a foto.<br>Por favor tente novamente.</center>");
         }
     } else {
         return false;
     }
     @session_start();
     $this->id_pessoa = @$_SESSION['id_pessoa'];
     session_write_close();
     $this->data_foto = str_replace("%2F", "/", $this->data_foto);
     $db = new clsBanco();
     $db->Consulta("INSERT INTO foto_portal ( nm_credito, ref_cod_foto_secao, ref_ref_cod_pessoa_fj, data_foto, titulo, descricao, caminho, altura, largura ) VALUES ( '{$this->nm_credito}', '1',  {$this->id_pessoa}, now(), '{$this->titulo}', '{$this->descricao}', '{$nome_do_arquivo}', {$fim_largura}, {$fim_altura} )");
     echo "<script>document.location='fotos_lst.php';</script>";
//.........这里部分代码省略.........
开发者ID:secteofilandia,项目名称:ieducar,代码行数:101,代码来源:fotos_cad.php


示例12: resizeImage

/**
* Generate images of alternate sizes.
*/
function resizeImage($cnvrt_arry)
{
    global $platform, $imgs, $cnvrt_path, $reqd_image, $convert_writable, $convert_magick, $convert_GD, $convert_cmd, $cnvrt_alt, $cnvrt_mesgs, $compat_quote;
    if (empty($imgs) || $convert_writable == FALSE) {
        return;
    }
    if ($convert_GD == TRUE && !($gd_version = gdVersion())) {
        return;
    }
    if ($cnvrt_alt['no_prof'] == TRUE) {
        $strip_prof = ' +profile "*"';
    } else {
        $strip_prof = '';
    }
    if ($cnvrt_alt['mesg_on'] == TRUE) {
        $str = '';
    }
    foreach ($imgs as $img_file) {
        if ($cnvrt_alt['indiv'] == TRUE && $img_file != $reqd_image['file']) {
            continue;
        }
        $orig_img = $reqd_image['pwd'] . '/' . $img_file;
        $cnvrtd_img = $cnvrt_path . '/' . $cnvrt_arry['prefix'] . $img_file;
        if (!is_file($cnvrtd_img)) {
            $img_size = GetImageSize($orig_img);
            $height = $img_size[1];
            $width = $img_size[0];
            $area = $height * $width;
            $maxarea = $cnvrt_arry['maxwid'] * $cnvrt_arry['maxwid'] * 0.9;
            $maxheight = $cnvrt_arry['maxwid'] * 0.75 + 1;
            if ($area > $maxarea || $width > $cnvrt_arry['maxwid'] || $height > $maxheight) {
                if ($width / $cnvrt_arry['maxwid'] >= $height / $maxheight) {
                    $dim = 'W';
                }
                if ($height / $maxheight >= $width / $cnvrt_arry['maxwid']) {
                    $dim = 'H';
                }
                if ($dim == 'W') {
                    $cnvt_percent = round(0.9375 * $cnvrt_arry['maxwid'] / $width * 100, 2);
                }
                if ($dim == 'H') {
                    $cnvt_percent = round(0.75 * $cnvrt_arry['maxwid'] / $height * 100, 2);
                }
                // convert it
                if ($convert_magick == TRUE) {
                    // Image Magick image conversion
                    if ($platform == 'Win32' && $compat_quote == TRUE) {
                        $winquote = '"';
                    } else {
                        $winquote = '';
                    }
                    exec($winquote . $convert_cmd . ' -geometry ' . $cnvt_percent . '%' . ' -quality ' . $cnvrt_arry['qual'] . ' -sharpen ' . $cnvrt_arry['sharpen'] . $strip_prof . ' "' . $orig_img . '"' . ' "' . $cnvrtd_img . '"' . $winquote);
                    $using = $cnvrt_mesgs['using IM'];
                } elseif ($convert_GD == TRUE) {
                    // GD image conversion
                    if (eregi('\\.jpg$|\\.jpeg$', $img_file) == TRUE && (imageTypes() & IMG_JPG) == TRUE) {
                        $src_img = imageCreateFromJpeg($orig_img);
                    } elseif (eregi('\\.gif$', $img_file) == TRUE && (imageTypes() & IMG_PNG) == TRUE) {
                        $src_img = imageCreateFromPng($orig_img);
                    } elseif (eregi('\\.gif$', $img_file) == TRUE && (imageTypes() & IMG_GIF) == TRUE) {
                        $src_img = imageCreateFromGif($orig_img);
                    } else {
                        continue;
                    }
                    $src_width = imageSx($src_img);
                    $src_height = imageSy($src_img);
                    $dest_width = $src_width * ($cnvt_percent / 100);
                    $dest_height = $src_height * ($cnvt_percent / 100);
                    if ($gd_version >= 2) {
                        $dst_img = imageCreateTruecolor($dest_width, $dest_height);
                        imageCopyResampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
                    } else {
                        $dst_img = imageCreate($dest_width, $dest_height);
                        imageCopyResized($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
                    }
                    imageDestroy($src_img);
                    if (eregi('\\.jpg$|\\.jpeg$/i', $img_file) == TRUE && (imageTypes() & IMG_JPG) == TRUE) {
                        imageJpeg($dst_img, $cnvrtd_img, $cnvrt_arry['qual']);
                    } elseif (eregi('\\.gif$', $img_file) == TRUE && (imageTypes() & IMG_PNG) == TRUE) {
                        imagePng($dst_img, $cnvrtd_img);
                    } elseif (eregi('\\.gif$/i', $img_file) == TRUE && (imageTypes() & IMG_GIF) == TRUE) {
                        imageGif($dst_img, $cnvrtd_img);
                    }
                    imageDestroy($dst_img);
                    $using = $cnvrt_mesgs['using GD'] . $gd_version;
                }
                if ($cnvrt_alt['mesg_on'] == TRUE && is_file($cnvrtd_img)) {
                    $str .= "  <small>\n" . '   ' . $cnvrt_mesgs['generated'] . $cnvrt_arry['txt'] . $cnvrt_mesgs['converted'] . $cnvrt_mesgs['image_for'] . $img_file . $using . ".\n" . "  </small>\n  <br />\n";
                }
            }
        }
    }
    if (isset($str)) {
        return $str;
    }
}
开发者ID:kleopatra999,项目名称:PHPhoto,代码行数:99,代码来源:index.php


示例13: make_thumbnails

 private function make_thumbnails($updir, $img)
 {
     $thumbnail_width = 146;
     $thumbnail_height = 116;
     $thumb_preword = "thumb_";
     $arr_image_details = GetImageSize("{$updir}" . "{$img}");
     $original_width = $arr_image_details[0];
     $original_height = $arr_image_details[1];
     if ($original_width > $original_height) {
         $new_width = $thumbnail_width;
         $new_height = intval($original_height * $new_width / $original_width);
     } else {
         $new_height = $thumbnail_height;
         $new_width = intval($original_width * $new_height / $original_height);
     }
     $dest_x = intval(($thumbnail_width - $new_width) / 2);
     $dest_y = intval(($thumbnail_height - $new_height) / 2);
     if ($arr_image_details[2] == 1) {
         $imgt = "ImageGIF";
         $imgcreatefrom = "ImageCreateFromGIF";
     }
     if ($arr_image_details[2] == 2) {
         $imgt = "ImageJPEG";
         $imgcreatefrom = "ImageCreateFromJPEG";
     }
     if ($arr_image_details[2] == 3) {
         $imgt = "ImagePNG";
         $imgcreatefrom = "ImageCreateFromPNG";
     }
     if ($imgt) {
         $old_image = $imgcreatefrom("{$updir}" . "{$img}");
         $new_image = imagecreatetruecolor($thumbnail_width, $thumbnail_height);
         imageCopyResized($new_image, $old_image, 0, 0, 0, 0, 146, 116, $original_width, $original_height);
         $imgt($new_image, "{$updir}" . "{$thumb_preword}" . "{$img}");
     }
 }
开发者ID:asimpatrasc,项目名称:elance-clone,代码行数:36,代码来源:admin.class.php


示例14: border

 public function border($size, $color)
 {
     if (!$this->_processedImage) {
         return false;
     }
     if (is_array($color)) {
         list($red, $green, $blue) = $color;
     } else {
         list($red, $green, $blue) = PGRThumb_Utils::html2rgb($color);
     }
     $width = $this->_width + 2 * $size;
     $height = $this->_height + 2 * $size;
     $newimage = imagecreatetruecolor($width, $height);
     $border_color = imagecolorallocate($newimage, $red, $green, $blue);
     imagefilledrectangle($newimage, 0, 0, $width, $height, $border_color);
     $res = imageCopyResized($newimage, $this->_processedImage, $size, $size, 0, 0, $this->_width, $this->_height, $this->_width, $this->_height);
     if ($res) {
         $this->_processedImage = $newimage;
     }
     $this->_width = $width;
     $this->_height = $height;
     return $res;
 }
开发者ID:Abuamany,项目名称:concerto-platform,代码行数:23,代码来源:GD.php


示例15: upMultImageWithThumb

function upMultImageWithThumb($destpath, $thumbPath, $file, $n_width, $n_height)
{
    $path = '';
    while (list($key, $value) = each($_FILES[$file]["name"])) {
        if (!empty($value)) {
            if ($_FILES[$file]["type"][$key] == "image/gif" || $_FILES[$file]["type"][$key] == "image/jpeg" || $_FILES[$file]["type"][$key] == "image/pjpeg" || $_FILES[$file]["type"][$key] == "image/png" && $_FILES[$file]["size"][$key] < 2000000) {
                $source = $_FILES[$file]["tmp_name"][$key];
                $filename = $_FILES[$file]["name"][$key];
                move_uploaded_file($source, $destpath . $filename);
                //echo "Uploaded: " . $destpath . $filename . "<br/>" ;
                $path .= $filename . '***';
                //thumbnail creation start//
                $tsrc = $thumbPath . $_FILES[$file]["name"][$key];
                // Path where thumb nail image will be stored
                //$n_width	=	100;          // Fix the width of the thumb nail images
                //$n_height	=	100;         // Fix the height of the thumb nail imaage
                /////////////////////////////////////////////// Starting of GIF thumb nail creation///////////
                $add = $destpath . $filename;
                if ($_FILES[$file]["type"][$key] == "image/gif") {
                    //echo "hello";
                    $im = ImageCreateFromGIF($add);
                    $width = ImageSx($im);
                    // Original picture width is stored
                    $height = ImageSy($im);
                    // Original picture height is stored
                    $newimage = imagecreatetruecolor($n_width, $n_height);
                    imageCopyResized($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height);
                    if (function_exists("imagegif")) {
                        Header("Content-type: image/gif");
                        ImageGIF($newimage, $tsrc);
                    }
                    if (function_exists("imagejpeg")) {
                        Header("Content-type: image/jpeg");
                        ImageJPEG($newimage, $tsrc);
                    }
                }
                //chmod("$tsrc",0777);
                ////////// end of gif file thumb nail creation//////////
                //$n_width=100;          // Fix the width of the thumb nail images
                //$n_height=100;         // Fix the height of the thumb nail imaage
                ////////////// starting of JPG thumb nail creation//////////
                if ($_FILES[$file]["type"][$key] == "image/jpeg") {
                    //echo $_FILES[$file]["name"][$key]."<br>";
                    $im = ImageCreateFromJPEG($add);
                    $width = ImageSx($im);
                    // Original picture width is stored
                    $height = ImageSy($im);
                    // Original picture height is stored
                    $newimage = imagecreatetruecolor($n_width, $n_height);
                    imageCopyResized($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height);
                    ImageJpeg($newimage, $tsrc);
                    chmod("{$tsrc}", 0777);
                }
                ////////////////  End of png thumb nail creation //////////
                if ($_FILES[$file]["type"][$key] == "image/png") {
                    //echo "hello";
                    $im = ImageCreateFromPNG($add);
                    $width = ImageSx($im);
                    // Original picture width is stored
                    $height = ImageSy($im);
                    // Original picture height is stored
                    $newimage = imagecreatetruecolor($n_width, $n_height);
                    imageCopyResized($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height);
                    if (function_exists("imagepng")) {
                        //Header("Content-type: image/png");
                        ImagePNG($newimage, $tsrc);
                    }
                    if (function_exists("imagejpeg")) {
                        //Header("Content-type: image/jpeg");
                        ImageJPEG($newimage, $tsrc);
                    }
                }
                // thumbnail creation end---
            } else {
                $msg = "error in upload";
                //return $msg;
            }
        }
        //if
    }
    //while
    $cnt = strlen($path) - 3;
    $pathnw = substr_replace($path, '', $cnt, 3);
    return $pathnw;
}
开发者ID:Entellus,项目名称:System,代码行数:85,代码来源:basic_functions1.php


示例16: imagecreatetruecolor

         $n_width = 230;
         if ($n_height > 160) {
             $n_width = $n_width / $n_height * 160;
             $n_height = 160;
         }
     }
     if ($height > 160) {
         $n_width = $width / $height * 160;
         $n_height = 160;
         if ($n_width > 230) {
             $n_height = $n_height / $n_width * 230;
             $n_width = 230;
         }
     }
     $newimage = imagecreatetruecolor($n_width, $n_height);
     imageCopyResized($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height);
     ImageJPEG($newimage, $tsrc);
 }
 //		$to = "[email protected]"; //
 //		$subject = "***Skippy Alert***"; //
 //		$body = "Somebody just used Skippy the Shoe Finder!"; //
 //		$headers = "From: [email protected]\n"; //
 //		mail($to,$subject,$body,$headers); //
 // Color Select //
 $sample = 100;
 $pig = 32;
 // Get picture height and width //
 $im = imagecreatefromjpeg($tsrc);
 $width = ImageSx($im);
 $height = ImageSy($im);
 $winc = round($width / sqrt($sample / ($height / $width)));
开发者ID:ezchx,项目名称:skippy,代码行数:31,代码来源:index.php


示例17: geraFotos

 function geraFotos($fotoOriginal)
 {
     list($imagewidth, $imageheight, $img_type) = @GetImageSize($fotoOriginal);
     $src_img_original = "";
     $fim_largura = $imagewidth;
     $fim_altura = $imageheight;
     $extensao = $img_type == "2" ? ".jpg" : ($img_type == "3" ? ".png" : "");
     $nome_do_arquivo = array_pop(explode("/", $fotoOriginal));
     //date('Y-m-d')."-".substr(md5($fotoOriginal), 0, 10).$extensao;
     $caminhoDaBig = "arquivos/acoes/fotos/big/{$nome_do_arquivo}";
     $caminhoDaFotoOriginal = "arquivos/acoes/fotos/original/{$nome_do_arquivo}";
     if ($imagewidth > 700) {
         $new_w = 700;
         $ratio = $imagewidth / $new_w;
         $new_h = ceil($imageheight / $ratio);
         $fim_largura = $new_w;
         $fim_altura = $new_h;
         if (!file_exists($caminhaDaBig)) {
             if ($img_type == "2") {
                 $src_img_original = @imagecreatefromjpeg($fotoOriginal);
                 $dst_img = @imagecreatetruecolor($new_w, $new_h);
                 imagecopyresized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, imagesx($src_img_original), imagesy($src_img_original));
                 imagejpeg($dst_img, $caminhoDaBig);
             } else {
                 if ($img_type == "3") {
                     $src_img_original = @ImageCreateFrompng($fotoOriginal);
                     $dst_img = @imagecreatetruecolor($new_w, $new_h);
                     ImageCopyResized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, ImageSX($src_img_original), ImageSY($src_img_original));
                     Imagepng($dst_img, $caminhoDaBig);
                 }
             }
         }
     } else {
         if (!file_exists($caminhoDaBig)) {
             copy($fotoOriginal, $caminhoDaBig);
             if ($img_type == "2") {
                 $src_img_original = @imagecreatefromjpeg($fotoOriginal);
             } else {
                 if ($img_type == "3") {
                     $src_img_original = @imagecreatefrompng($fotoOriginal);
                 }
             }
         }
     }
     $new_w = 100;
     $ratio = $imagewidth / $new_w;
     $new_h = round($imageheight / $ratio);
     $caminhoDaSmall = "arquivos/acoes/fotos/small/{$nome_do_arquivo}";
     if (!file_exists($caminhaDaBig)) {
         if ($img_type == "2") {
             $dst_img = @imagecreatetruecolor($new_w, $new_h);
             @imagecopyresized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, imagesx($src_img_original), imagesy($src_img_original));
             @imagejpeg($dst_img, $caminhoDaSmall);
         } else {
             if ($img_type == "3") {
                 $dst_img = @imagecreatetruecolor($new_w, $new_h);
                 @imageCopyResized($dst_img, $src_img_original, 0, 0, 0, 0, $new_w, $new_h, ImageSX($src_img_original), imageSY($src_img_original));
                 @imagepng($dst_img, $caminhoDaSmall);
             }
         }
     }
     copy($fotoOriginal, $caminhoDaFotoOriginal);
     if (!(file_exists($fotoOriginal) && file_exists($caminhoDaSmall) && file_exists($caminhoDaBig))) {
         die("<center><br>Um erro ocorreu ao inserir a foto.<br>Por favor tente novamente.</center>");
     }
 }
开发者ID:secteofilandia,项目名称:ieducar,代码行数:66,代码来源:acoes_foto.php


示例18: cropAndResize

 public function cropAndResize($cropLeft, $cropTop, $cropWidth, $cropHeight, $resizeWidth, $resizeHeight)
 {
     $cropLeft = (int) $cropLeft;
     $cropTop = (int) $cropTop;
     $cropWidth = (int) $cropWidth;
     $cropHeight = (int) $cropHeight;
     $resizeWidth = (int) $resizeWidth;
     $resizeHeight = (int) $resizeHeight;
     $image = imageCreateTrueColor($resizeWidth, $resizeHeight);
     $this->_adjustTransparency($this->_object, $image);
     if ($this->_isTransparent($this->_object)) {
         imageCopyResized($image, $this->_object, 0, 0, $cropLeft, $cropTop, $resizeWidth, $resizeHeight, $cropWidth, $cropHeight);
     } else {
         imageCopyResampled($image, $this->_object, 0, 0, $cropLeft, $cropTop, $resizeWidth, $resizeHeight, $cropWidth, $cropHeight);
     }
     if ($this->_isResource($image)) {
         $this->_object = $image;
         return true;
     }
     throw new Exception("Failed to crop and resize object.");
 }
开发者ID:edukondaluetg,

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP imageCreate函数代码示例发布时间:2022-05-15
下一篇:
PHP imageCopyResampled函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap