- MIUI / HyperOS topik
- Telekom mobilszolgáltatások
- iPhone topik
- One UI 6.1.1 hamarosan, One UI 7 még idén
- Jelentősen drágulhatnak a Samsung hajlíthatók
- Redmi Note 13 Pro 5G - nem százas, kétszázas!
- A Qualcomm lehet a Galaxy S25 kizárólagos chipszállítója
- Megérkezett a Google Pixel 7 és 7 Pro
- Apple iPhone 15 Pro Max - Attack on Titan
- Xiaomi 13T és 13T Pro - nincs tétlenkedés
Hirdetés
-
Ellopták a Tesla akkumulátor-titkait
it Beperelte egy korábbi beszállítóját a Tesla, és azzal vádolja, hogy üzleti titkokat lopott a Tesla akkumulátorgyártási technológiájával kapcsolatban.
-
RISC-V alaplap a Framework Laptop 13 notebookhoz
ph A szabadon szerelhető, bővíthető noteszgépbe a DeepComputing jóvoltából kerülhet a nyílt platform.
-
Computex 2024: Térhangzás bárhol, bármihez a Creative új fej- és fülhallgatóival
ma Zen Hybrid SXFI, Zen Air SXFI és Zen Hybrid Pro SXFI néven új audio termékekkel bővíti kínálatát a Creative Technology.
Ú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);
}