Problem s Nette\Utils\Image

Tomas8698
Člen | 109
+
0
-

Ahojte 🙂, mam problém s prácou s obrázkami, keď zadám príkaz:
`php
$image= Image::fromFile(„asds. Jpg“) ;
`
Tak mi vypíše chybu PHP extension GD is not loaded
V use mam use Nette\Utils\Image;
Neviete, kde by mohla byt chyba?

Kamil Valenta
Člen | 758
+
+2
-

Prostě nemáš GD nainstalovanou.
https://www.php.net/…allation.php

Tomas8698
Člen | 109
+
0
-

Aha ďakujem pekne 🙂

Tomas8698
Člen | 109
+
0
-

Ešte mam jeden problem, v resp. neviem ci som funkciu na vyhladanie fromFile pochopil spravne, potrebujem na zaklade informacie z url najst obrazok a zmenit velkost. Ale ked prejdem na stranku tak mi vypise ze:

Unknown type of file '/home/tomas/Plocha/gallery/www/AllGalleries/name/asds.jpg'.
public function actionDefault($width, $height , $fullPath){

        $dir = dirname(__DIR__ ,2);
        $pathAllGallery = $dir.'/www/AllGalleries';
        $image = glob($pathAllGallery."/*/".$fullPath.".{jpg,png,gif}", GLOB_BRACE);

        if (count($image) !== 0){

            $thisImage = Image::fromFile($image.".jpg");

        if($width>0 && $height >0){
            $thisImage->resize($width, $height);
        }
        elseif ($width === 0 ){
            $thisImage->resize(null, $height);
        }
        elseif($height === 0){
            $thisImage->resize($width, null);
        }

Neviete kde by mohla byt chyba?

Editoval Tomas8698 (6. 10. 2021 18:45)

Tomas8698
Člen | 109
+
0
-

Problem vyriešeni, nakoniec bola chybná cesta, ktorú som zadával. 🙂

`php
$thisImage = Image::fromFile(„.. /www/AllGalleries/.$nameGallery.“/„.$fullPath.“.jpg");

`