Uložení png s transparent pozadím
- uzziel
- Člen | 46
Čus, jsem zpět (plný radosti).
Řeším problém s ukládáním png. Místo transparent pozadí to uloží s černým pozadím – stejně jak píšou tady https://forum.nette.org/…image-resize
<?php
$image = Image::fromFile($Src);
$image->crop('50%', '50%', $Width, $Height);
$thumbnail = $this->pathToThumbnail . $Size . '_' . $Filename;
$image->save($thumbnail, 100, Image::PNG);
?>
Rád bych věděl, kde dělám chybu.
Díky.
- uzziel
- Člen | 46
Mysteria napsal(a):
Nastavit tohle po tom oříznutí jsi zkoušel? Protože letmý pohled na Google doporučuje totéž…
$image->alphaBlending(false); $image->saveAlpha(true);
Funkční, dík. Já to tam nedával kvůli Davidovi – https://forum.nette.org/…image-resize#…
- uzziel
- Člen | 46
utils v3.0.1
gd produkční server
array(14) { ["GD Version"]=> string(26) "bundled (2.1.0 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPEG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XPM Support"]=> bool(false) ["XBM Support"]=> bool(true) ["WebP Support"]=> bool(true) ["BMP Support"]=> bool(true) ["TGA Read Support"]=> bool(true) ["JIS-mapped Japanese Font Support"]=> bool(false) }
gd localhost
array(13) { ["GD Version"]=> string(26) "bundled (2.1.0 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPEG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XPM Support"]=> bool(true) ["XBM Support"]=> bool(true) ["WebP Support"]=> bool(true) ["BMP Support"]=> bool(true) ["JIS-mapped Japanese Font Support"]=> bool(false) }
- Marek Bartoš
- Nette Blogger | 1146
Já se divím, že při tom neustálém hanění Nette už dávno nefixnul problém sám, když je tady velmistr očividně mnohem zkušenější programátor, než my všichni dohromady. Bugy ve svém kódu nevytváří a jelikož vidí i do budoucnosti, tak bugy v GD knihovně vidí na celé roky dopředu :)