Új hozzászólás Aktív témák
-
Tele von Zsinór
őstag
válasz
Speeedfire
#5009
üzenetére
static public function resizeAndMove($from_path, $to_path, $max_width, $max_height)
{
@ini_set("memory_limit", "128M");
$image_info = getImageSize($from_path);
switch ($image_info['mime']) {
case 'image/jpeg': $o_im = imageCreateFromJPEG($from_path); break;
//add more if needed
default:
return false;
}
$o_wd = imagesx($o_im) ;
$o_ht = imagesy($o_im) ;
if ($o_ht >= $o_wd) {
if ($o_ht > $max_height) {
$lamda = $max_height / $o_ht;
} else {
$lamda = 1;
}
} else {
if ($o_wd > $max_width) {
$lamda = $max_width / $o_wd;
} else {
$lamda = 1;
}
}
$t_ht = round($lamda * $o_ht);
$t_wd = round($lamda * $o_wd) ;
$t_im = imageCreateTrueColor($t_wd,$t_ht);
imageCopyResampled($t_im, $o_im, 0, 0, 0, 0, $t_wd, $t_ht, $o_wd, $o_ht);
imagePNG($t_im, $to_path );
imageDestroy($o_im);
imageDestroy($t_im);
}
Új hozzászólás Aktív témák
- Bomba ár! Microsoft Surface Go 1 Tablet - Intel 4415Y I 4GB I 128SSD I W10 I Cam I Garancia!
- Samsung Galaxy A53 5G 128GB, Kártyafüggetlen, 1 Év Garanciával
- BESZÁMÍTÁS! GIGABYTE B760M i7 12700 32GB DDR4 512GB SSD RX 7800 XT 16GB LianLi Lancool 216 ARGB 750W
- Telefon felvásárlás!! Xiaomi Redmi 9, Xiaomi Redmi 9AT, Xiaomi Redmi 10, Xiaomi Redmi 10 2022
- Keresünk iPhone 16/16 Plus/16e/16 Pro/16 Pro Max
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest

