Visualizzazione dei risultati da 1 a 6 su 6

Discussione: [php] Gd

  1. #1
    Utente di HTML.it L'avatar di joker06
    Registrato dal
    Dec 2006
    Messaggi
    782

    [php] Gd

    salve. questo è l'errore che mi viene a video quando provo a caricare un immagine e ridimensionarla. visto che l'upload mi funzionava correttamente il resize mi dice:

    Fatal error: Call to undefined function: imagecreatefromgif() in D:\Inetpub\webs\k6blueit\form_test\resize.php on line 48

    a quanto pare sembra un problema di librerie che sul mio hosting windows di aruba non sono presenti.
    prima di spendere dei soldi per fare il doppio hosting windows+linux volevo avere la certezza che fosse un vero problema di librerie.
    Codice PHP:
    class thumbnail
    {
        var 
    $img;

        function 
    thumbnail($imgfile)
        {
            
    //detect image format
            
    $this->img["format"]=ereg_replace(".*\.(.*)$","\\1",$imgfile);
            
    $this->img["format"]=strtoupper($this->img["format"]);
            if (
    $this->img["format"]=="JPG" || $this->img["format"]=="JPEG") {
                
    //JPEG
                
    $this->img["format"]="JPEG";
                
    $this->img["src"] = ImageCreateFromJPEG ($imgfile);
            } elseif (
    $this->img["format"]=="PNG") {
                
    //PNG
                
    $this->img["format"]="PNG";
                
    $this->img["src"] = ImageCreateFromPNG ($imgfile);
            } elseif (
    $this->img["format"]=="GIF") {
                
    //GIF
                
    $this->img["format"]="GIF";
                
    $this->img["src"] = ImageCreateFromGIF ($imgfile);
            } elseif (
    $this->img["format"]=="WBMP") {
                
    //WBMP
                
    $this->img["format"]="WBMP";
                
    $this->img["src"] = ImageCreateFromWBMP ($imgfile);
            } else {
                
    //DEFAULT
                
    echo "Not Supported File";
                exit();
            }
            @
    $this->img["lebar"] = imagesx($this->img["src"]);
            @
    $this->img["tinggi"] = imagesy($this->img["src"]);
            
    //default quality jpeg
            
    $this->img["quality"]=75;
        }

        function 
    size_height($size=100)
        {
            
    //height
            
    $this->img["tinggi_thumb"]=$size;
            @
    $this->img["lebar_thumb"] = ($this->img["tinggi_thumb"]/$this->img["tinggi"])*$this->img["lebar"];
        }

        function 
    size_width($size=100)
        {
            
    //width
            
    $this->img["lebar_thumb"]=$size;
            @
    $this->img["tinggi_thumb"] = ($this->img["lebar_thumb"]/$this->img["lebar"])*$this->img["tinggi"];
        }

        function 
    size_auto($size=100)
        {
            
    //size
            
    if ($this->img["lebar"]>=$this->img["tinggi"]) {
                
    $this->img["lebar_thumb"]=$size;
                @
    $this->img["tinggi_thumb"] = ($this->img["lebar_thumb"]/$this->img["lebar"])*$this->img["tinggi"];
            } else {
                
    $this->img["tinggi_thumb"]=$size;
                @
    $this->img["lebar_thumb"] = ($this->img["tinggi_thumb"]/$this->img["tinggi"])*$this->img["lebar"];
             }
        }

        function 
    jpeg_quality($quality=75)
        {
            
    //jpeg quality
            
    $this->img["quality"]=$quality;
        }

        function 
    show()
        {
            
    //show thumb
            
    @Header("Content-Type: image/".$this->img["format"]);

            
    /* change ImageCreateTrueColor to ImageCreate if your GD not supported ImageCreateTrueColor function*/
            
    $this->img["des"] = ImageCreateTrueColor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);
                @
    imagecopyresized ($this->img["des"], $this->img["src"], 0000$this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]);

            if (
    $this->img["format"]=="JPG" || $this->img["format"]=="JPEG") {
                
    //JPEG
                
    imageJPEG($this->img["des"],"",$this->img["quality"]);
            } elseif (
    $this->img["format"]=="PNG") {
                
    //PNG
                
    imagePNG($this->img["des"]);
            } elseif (
    $this->img["format"]=="GIF") {
                
    //GIF
                
    imageGIF($this->img["des"]);
            } elseif (
    $this->img["format"]=="WBMP") {
                
    //WBMP
                
    imageWBMP($this->img["des"]);
            }
        }

        function 
    save($save="")
        {
            
    //save thumb
            
    if (empty($save)) $save=strtolower("./thumb.".$this->img["format"]);
            
    /* change ImageCreateTrueColor to ImageCreate if your GD not supported ImageCreateTrueColor function*/
            
    $this->img["des"] = ImageCreateTrueColor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);
                @
    imagecopyresized ($this->img["des"], $this->img["src"], 0000$this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]);

            if (
    $this->img["format"]=="JPG" || $this->img["format"]=="JPEG") {
                
    //JPEG
                
    imageJPEG($this->img["des"],"$save",$this->img["quality"]);
            } elseif (
    $this->img["format"]=="PNG") {
                
    //PNG
                
    imagePNG($this->img["des"],"$save");
            } elseif (
    $this->img["format"]=="GIF") {
                
    //GIF
                
    imageGIF($this->img["des"],"$save");
            } elseif (
    $this->img["format"]=="WBMP") {
                
    //WBMP
                
    imageWBMP($this->img["des"],"$save");
            }
        }
    }
    ?> 

  2. #2
    se è aruba sei costretto a prendere il doppio hosting

  3. #3
    Utente di HTML.it L'avatar di joker06
    Registrato dal
    Dec 2006
    Messaggi
    782
    quello si è gia stato appurato però io vorrei essere sicuro che sia il problema delle GD perche magari spendere soldi per niente...
    per fare il resize devo cmq usarle per forza vero?

  4. #4
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    Sì, sono le GD (che mancano, come tra l'altro segnalato nella descrizione del tuo pacchetto hosting), assicurato.
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  5. #5
    Utente di HTML.it L'avatar di joker06
    Registrato dal
    Dec 2006
    Messaggi
    782
    nel pacchetto non venivano proprio menzionate quindi... ho si da per scontato che ci siano o le omettono perche semmai nessuno lo prenderebbe. siccome era il primo ci son cascato e siccome mi serve per fare delle prove di un lavoro me lo sono preso nel.... ma l'esperienza insegna..

  6. #6
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    Originariamente inviato da joker06
    nel pacchetto non venivano proprio menzionate quindi... ho si da per scontato che ci siano o le omettono perche semmai nessuno lo prenderebbe. siccome era il primo ci son cascato e siccome mi serve per fare delle prove di un lavoro me lo sono preso nel.... ma l'esperienza insegna..
    Vai all'home page del tuo servizio hosting, scegli Domini & Hosting -> Windows e quindi "Caratteristiche Servizi": sotto "Linguaggi Supportati": GDLib e ImageMagick non sono inclusi nel pacchetto windows.
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.