Visualizzazione dei risultati da 1 a 8 su 8
  1. #1
    Utente di HTML.it L'avatar di lyllo
    Registrato dal
    Apr 2001
    Messaggi
    832

    Problema con inclusione di una funzione.

    sto provando a creare dei thumbnails dopo che l'utente invia le sue immagini in rete.
    ho trovato una funzione qui sul sito:
    Codice PHP:
    <?php

      
    /************************************************************\
      *
      *    Basic Thumbnail Generator Copyright 2007 Derek Harvey
      *         [url]www.lotsofcode.com[/url]
      *
      *    This file is part of Basic Thumbnail Generator.
      *
      *    Basic Thumbnail Generator is free software; you can redistribute it and/or modify
      *    it under the terms of the GNU General Public License as published by
      *    the Free Software Foundation; either version 2 of the License, or
      *    (at your option) any later version.
      *
      *    Basic Thumbnail Generator is distributed in the hope that it will be useful,
      *    but WITHOUT ANY WARRANTY; without even the implied warranty of
      *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      *    GNU General Public License for more details.
      *
      *    You should have received a copy of the GNU General Public License
      *    along with Basic Thumbnail Generator; if not, write to the Free Software
      *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      *
      *
      \************************************************************/

      
    require_once 'thumbnail.class.php';    
      
    $thumbnail = new thumbnail;
      
      if (!empty(
    $_REQUEST['submit']))
      {
          
    $tmp $_FILES['uploaded_file']['tmp_name']; 
          
    $org $_FILES['uploaded_file']['name'];
          
          if (
    $tmp)
          {
              
    $directory 'uploads'// Upload files to here.
              
    $prefix 'uploaded_'// Filename prefixes
              
              // Upload all image files
              
    $lrgImage $thumbnail->generate($tmp$org$directory$prefix.'lrg'300); // large file
              
    $medImage $thumbnail->generate($tmp$org$directory$prefix.'med'200); // medium file
              
    $smlImage $thumbnail->generate($tmp$org$directory$prefix.'sml'100); // small file
              
              
    if ($smlImage && $medImage && $lrgImage// If all files are ok
              
    {
                  
    $info '
            <fieldset>
              <legend>Files uploaded successfully</legend>
              [img]'
    .$lrgImage.'[/img]
              [img]'
    .$medImage.'[/img]
              [img]'
    .$smlImage.'[/img]
            </fieldset>

            '
    ;
              }
          }
          else
          {
              
    $info '

    No file selected</p>'
    ;
          }
      }
      
    ?>
    che richiamo in un'altra pagina:
    Codice PHP:
    require_once('thumbnail.class.php');
    $t $_FILES["file$k"]['tmp_name'];
    $sz $_FILES["file$k"]['size'];
    $n  $_FILES["file$k"]['name'];
    $dest "../img/immagini/";
    $smlImage $thumbnail->generate($t$n$dest."/TB"'TB_'.$n100); 
    ma ricevo questo messaggio di errore: Fatal error: Call to a member function on a non-object in C:\WM\www\galleria\spt\add_imgs.php on line 50

    mi sapete spiegare dove sbaglio?
    grazie.

  2. #2
    Quale e' la riga 50 del file C:\WM\www\galleria\spt\add_imgs.php ?

  3. #3
    Utente di HTML.it L'avatar di lyllo
    Registrato dal
    Apr 2001
    Messaggi
    832
    Codice PHP:
    $smlImage $thumbnail->generate($t$n$dest."/TB"'TB_'.$n100); 
    questa

  4. #4
    Inserisci all'inizio del tuo script il seguente codice:

    Codice PHP:
    error_reporting(E_ALL);
    ini_set('display_errors'1); 

  5. #5
    Utente di HTML.it L'avatar di lyllo
    Registrato dal
    Apr 2001
    Messaggi
    832
    nn cambia nulla.
    i messaggi sono gli stessi di prima

  6. #6
    Dopo $thumbnail = new thumbnail; inserisci:

    Codice PHP:
    var_dump($thumbnail);
    die() 

  7. #7
    Se non crei l'oggetto thumbnail, non lo puoi usare!
    Codice PHP:
    require_once('thumbnail.class.php');
    $thumbnail = new thumbnail;  // <---- DEVO creare l'oggetto thumbnail, per poi poterlo 'usare' !
    $t $_FILES["file$k"]['tmp_name'];
    $sz $_FILES["file$k"]['size'];
    $n  $_FILES["file$k"]['name'];
    $dest "../img/immagini/";
    $smlImage $thumbnail->generate($t$n$dest."/TB"'TB_'.$n100); 
    HTH
    Zappa
    [PC:Presario 2515EU][Cpu:P4@2.3GHz][Ram: 512M][HDU:80G@5400 RPM]
    [Wireless:LinkSys][OS: Ubuntu 9.04 - Jaunty Jackalope]

  8. #8
    Utente di HTML.it L'avatar di lyllo
    Registrato dal
    Apr 2001
    Messaggi
    832
    ah ok ecco perchè.
    non sono pratico co ste cacchio di immagini e robe varie
    devo provarci cmq, ora sono in ufficio e non ho modo di farlo.
    terrovvi informati.

    ma è necessario il var_dump()?

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.