-

  • (102)
  • web- (38)
  • (22)
  • (14)
  • (13)
  • (11)
  • (3)
  • (3)

 - e-mail

 

 -

   community_coding

 -

 LiveInternet.ru:
: 29.12.2004
:
:
: 536

:


, 18 2006 . 07:25 +
av3nger php. . . . , . .. , . X Y. (X Y ).

:
PHP:

$thumbsize 
150;
$imginfo getimagesize($imgfile);
$width $imginfo[0];
$height $imginfo[1];
$imgratio $width $thumbsize;
$imgratio max($imgratio1.0);
$newwidth = (int)($width $imgratio);
$newheight = (int)($height $imgratio);
$thumb ImageCreateTrueColor($newwidth,$newheight);
$source imagecreatefromjpeg($imgfile);
imagecopyresampled($thumb$source0000$newwidth, (int)$newheight$width$height);
imagejpeg($thumb,"../images/gallery/main/main_".$filename,100);
font>



. .. , " " ( ).
- - ?


: [1] []
mesca1ito   , 18 2006 . 11:49 ()
... ... Perl' bash'. ( , ) -- , ..
   
ellesar2001   , 18 2006 . 15:09 ()
:
code:
function imageresize($path, $newwidth) {
list($width, $height) = @getimagesize($path);

$newheight = $height/($width/$newwidth);

$new = @imagecreatetruecolor($newwidth, $newheight);
$source = @imagecreatefromjpeg($path);

@imagecopyresized($new, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

@imagejpeg($new, $path);
}

?
   
av3nger   , 18 2006 . 15:33 ()
ellesar2001, , , . 150px 20px, 150150, 60120. 3211 .
   
av3nger   , 21 2006 . 01:28 ()
, .

cropW cropH .

code:
$imginfo = getimagesize($imgfile);
$width = $imginfo[0];
$height = $imginfo[1];
$cropStartX = round($width/2)-80;
$cropStartY = round($height/2)-60;
$cropW = 144;
$cropH = 119;
$origimg = imagecreatefromjpeg($imgfile);
$cropimg = imagecreatetruecolor($cropW,$cropH);
list($width, $height) = getimagesize($imgfile);
imagecopyresized($cropimg, $origimg, 0, 0, $cropStartX, $cropStartY, $width, $height, $width, $height);
imagejpeg($cropimg,"../images/gallery/main/main_".$filename,100);
imagedestroy($cropimg);
imagedestroy($origimg);


. ( 200 ). .
   
: [1] []
 

:
: 

: ( )

:

  URL