php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2004-2

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 07.12.2004, 09:11  
Gast
 
Beiträge: n/a
Standard Uploader-Script fehler beim Thumbx erstellen

Hallo, ich habe das Script nun ein einer Datei zusammengeführt

Hier das Cript
PHP-Code:
// integrate into vbb
error_reporting(E_ALL & ~E_NOTICE);
require_once(
'./global.php');

// define some important constants
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''uploader');

// pre-cache templates used by all actions
$globaltemplates = array('uploader');

// set usergroup can access this script
if (!in_array($bbuserinfo['usergroupid'], array(2,5,6,7,8,9,11)))
print_no_permission(); }

// uploader settings
$date date("m.d.y");
//$dir = "C:/Inetpub/wwwroot"; // absolute path/dir where images are to be uploaded or /home/user/public_html/uploads for *nix
$dir "/var/www/web1/html/images/fremd/script/";
$ext = array(".gif"".jpg"".jpeg"".png"); //allowed file extensions. To add more ext, use comma to seperate them
$maxdirsize "100000"// KB ~ 100 MB, this is max size of your uploads directory
$allowsize "2048"// max filesize allowed to upload (in KB)
$url "http://pics.celebritymarkt.de/images/fremd/script/$date/"// Full URL to your upload dir
$maxwidth 1048// for images only ... set this if you don't ppl to upload large images, breaking table cell of your forum.
$maxheight 1500// for images only


/******** No further editting necessary (unless you know what you doing) *********/
// initialize & vars declaration
$title "All4A Image Uploader - powered by tnguy3n © all4actions.net";
$header "<font size=+1 color=darkgreen>[b]Image Uploader[/b]</font>";
$msg ""// initialize
$filename $_FILES['img']['name'];
$imgurl $url $filename;
$dimension = @ getimagesize($_FILES['img']['tmp_name']);
$width $dimension[0];
$height $dimension[1];
$curdir $dir "/" $date;
$thumb $curdir "/" "thumb_" $filename;
$thumburl $url "thumb_" $filename;
$new_width 100// max width for thumbnail
$new_height 100// max height for thumbnail

// first of all, let's check if the folder of current date already exists
// treat dir as file and proceeding checking
if(!file_exists("$curdir")){
mkdir("$curdir"0777); // chmod 0777
touch("$curdir/index.html"); //create blank index file to prevent dir browsing
//closedir("$curdir");
}

if (
$do == 'upload') {

    if (
$_FILES['img']['name'] == "") {
        
$msg "<center><font color=\"red\">Please select a file to upload!</font></center>";
    }

    elseif (
file_exists("$curdir/".$_FILES['img']['name'])) {
        
$msg "<center><font color=\"red\">Filename "."[b]"$_FILES['img']['name']."[/b]" " already exists. Please rename or upload a different file.</font></center>";
    }
    
    elseif (!
in_array(strrchr($_FILES['img']['name'],'.'),$ext)) {
        
$msg "<center><font color=\"red\">That file type is not allowed!</font></center>";
    }
    
    elseif ((
$_FILES['img']['size']/1024) > $allowsize) {
        
$msg "<center><font color=\"red\">The file you try to upload is too big, [b]" round($_FILES['img']['size']/1020) . " KB[/b]. Resize or upload different file!</font></center>";
    }
    
    elseif (
strrchr($_FILES['img']['name'],' ')) {
        
$msg "<center><font color=\"red\">Filename must not contain whitespace!</font></center>";
    }
    
    elseif(
$width $maxwidth || $height $maxheight) {
        
$msg "<center><font color=\"red\">The image you try to upload is too large, " $dimension[0] . " x " $dimension[1] . ". Max width x height: " $maxwidth " x " $maxheight "</font></center>";
    }
    
    else {
        @
copy($_FILES['img'][tmp_name], "$curdir/".$_FILES['img']['name']) or die("Couldn't Upload File. Check chmod of your upload dir, it must be writable.");

        
$end strtolower(substr($filenamestrrpos($filename,'.')+1));
        if( 
$end == 'gif'){ $img imagecreatefromgif("$curdir"."/"."$filename"); } 
        elseif( 
$end == 'jpg' || $end == 'jpeg' ){ $img imagecreatefromjpeg("$curdir"."/"."$filename"); }
        elseif( 
$end == 'png' ){$img imagecreatefrompng("$curdir"."/"."$filename"); }

        if(
$width >= $height
        { 
            
$new_width $new_width $height width// can be omitted
            
$new_height $new_height $width $height
         } 
        if(
$width $height
        { 
            
$new_width $new_width $height $width
            
$new_height $new_height $width $height// can be omitted
        


        
$thumbnail imagecreate($new_width$new_height); 
        
// consider imagecopyresampled (required GD 2.0) for better quality
        
imagecopyresized($thumbnail$img0000$new_width,$new_height$width$height); 
        if(
$end == 'gif'){ imagegif($thumbnail$thumb); }
        elseif(
$end == 'jpg' || $end == 'jpeg'){ imagejpeg($thumbnail$thumb100); }
        elseif(
$end == 'png'){ imagepng($thumbnail$thumb); }

        
/* // okie, now is to insert info into database.
        $imginsert = $DB_site->query("INSERT INTO ". TABLE_PREFIX . "uploader(filename, filesize, imgwidth, imgheight, uploaddate, filelocation, owner, alt)
                VALUES($_FILES[img][name], $filesize, $width, $height, $date, $filelocation, $bbuserinfo[username], '')");*/

        
        // wrap it up and print result
        
$msg "<font color=red>Image [b]" $filename "[/b] has sucessfully uploaded!</font>";
        eval(
'print_output("' fetch_template('uploader_result') . '");');
        exit;
    }
}


eval(
'print_output("' fetch_template('uploader') . '");');

?> 
Bekomme nun aber follende Fehler
Zitat:
Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: in /var/www/web1/html/testvb/uploader.php on line 92

Warning: imagecreatefromjpeg(): '/var/www/web1/html/images/fremd/script//12.07.04/12312312.jpg' is not a valid JPEG file in /var/www/web1/html/testvb/uploader.php on line 92

Warning: Division by zero in /var/www/web1/html/testvb/uploader.php on line 97

Warning: imagecreate(): Invalid image dimensions in /var/www/web1/html/testvb/uploader.php on line 106

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /var/www/web1/html/testvb/uploader.php on line 108

Warning: imagejpeg(): supplied argument is not a valid Image resource in /var/www/web1/html/testvb/uploader.php on line 110
Kann mir jemand sagen woran das liegen kann ?
 
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 07.12.2004, 09:14  
Erfahrener Benutzer
 
Registriert seit: 18.09.2003
Beiträge: 13.598
PHP-Kenntnisse:
Fortgeschritten
imported_Ben ist zur Zeit noch ein unbeschriebenes Blatt
Standard

was ist denn zeile 92. hast du gegoogelt?
imported_Ben ist offline  
Alt 07.12.2004, 09:18  
Erfahrener Benutzer
 
Benutzerbild von JEGO
 
Registriert seit: 01.12.2003
Beiträge: 2.555
PHP-Kenntnisse:
Anfänger
JEGO wird schon bald berühmt werden
Standard

Also ich kann mich täuschen aber für mich sieht das aus als wenn du die falsche GD version benutzt auf deinem Server...(wo immer der auch liegt)

google mal danach....
__________________
Gruß JEGO

Ein PHP Script tut, was Du schreibst, nicht was Du willst.
JEGO ist offline  
Alt 07.12.2004, 10:26  
Gast
 
Beiträge: n/a
Standard

Ich nutze GD2 ist das nicht die richtige für dieses Script ?

Wonach soll ich Googlen ?

Gruß
Snatch

Hier mal die Zeilen, die Fehler ausgeben

Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: in /var/www/web1/html/testvb/uploader.php on line 92
Code:
elseif( $end == 'png' ){$img = imagecreatefrompng("$curdir"."/"."$filename"); }
Warning: imagecreatefromjpeg(): '/var/www/web1/html/images/fremd/script//12.07.04/12312312.jpg' is not a valid JPEG file in /var/www/web1/html/testvb/uploader.php on line 92
Code:
elseif( $end == 'png' ){$img = imagecreatefrompng("$curdir"."/"."$filename"); }
arning: Division by zero in /var/www/web1/html/testvb/uploader.php on line 97
Code:
$new_width = $new_width * $height / width; // can be omitted
Warning: imagecreate(): Invalid image dimensions in /var/www/web1/html/testvb/uploader.php on line 106
Code:
$thumbnail = imagecreate($new_width, $new_height);
Warning: imagecopyresized(): supplied argument is not a valid Image resource in /var/www/web1/html/testvb/uploader.php on line 108
Code:
imagecopyresized($thumbnail, $img, 0, 0, 0, 0, $new_width,$new_height, $width, $height);
Warning: imagejpeg(): supplied argument is not a valid Image resource in /var/www/web1/html/testvb/uploader.php on line 110
Code:
elseif($end == 'jpg' || $end == 'jpeg'){ imagejpeg($thumbnail, $thumb, 100); }
 
Alt 07.12.2004, 10:29  
Gast
 
Beiträge: n/a
Standard

is not a valid JPEG file
Noch viel deutlicher geht eine Fehlermeldung eigentlich nicht, oder?

Gruß
phpfan
 
Alt 07.12.2004, 10:31  
Gast
 
Beiträge: n/a
Standard

Zitat:
Zitat von phpfan
is not a valid JPEG file
Noch viel deutlicher geht eine Fehlermeldung eigentlich nicht, oder?

Gruß
phpfan
Was wilslt du mir damit sagen ? das ich keine Gifs hochladen kann ? Das sollte aber mit diesem Script gehen. Ach verdammt, ich werde das nie hinbekommen
 
Alt 07.12.2004, 10:34  
Gast
 
Beiträge: n/a
Standard

Hallo?????? Das kann doch nicht so schwer sein!

is not a valid JPEG file
Du versuchst ein Jpeg-File zu laden, was aber keins ist.

Gruß
phpfan
 
Alt 07.12.2004, 10:35  
Gast
 
Beiträge: n/a
Standard

Naja o.k. ich habe gerade ein Jpeg geladen das eines ist, dann bleibt die Fehlermeldugn auch aus. Aber es kommen immernoch diese hier.

Warning: Division by zero in /var/www/web1/html/testvb/uploader.php on line 97

Warning: imagecreate(): Invalid image dimensions in /var/www/web1/html/testvb/uploader.php on line 106

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /var/www/web1/html/testvb/uploader.php on line 108

Warning: imagejpeg(): supplied argument is not a valid Image resource in /var/www/web1/html/testvb/uploader.php on line 110


Gruß
Snatch

Schade das es so ein Script nicht fertig gibt
 
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
php script Fehler andi PHP Tipps 2008 17 30.07.2008 18:50
Ganz einfaches Script nur wo ist der Fehler? aerow90 PHP Tipps 2008 10 20.07.2008 23:18
Fehler beim erstellen eines posts brian johnson Off-Topic Diskussionen 0 03.09.2007 17:15
Fehler im Script, Unexpected , or ; PHP Tipps 2006 12 19.04.2006 21:20
Habe ein FEHLER im script enska PHP Tipps 2006 9 15.04.2006 01:27
[Erledigt] Counter script, kleiner OOP fehler? PHP-Fortgeschrittene 10 30.11.2005 22:34
Frage: Suche Fehler in diesem Script... PHP Tipps 2005-2 14 25.10.2005 19:24
PHP-Bild direkt im Script erstellen? Mex PHP Tipps 2005-2 10 22.08.2005 21:06
Fehler beim erstellen von Dateien PHP Tipps 2005 8 26.05.2005 12:04
[Erledigt] E-Mail Adresse per PHP Script erstellen? PHP-Fortgeschrittene 3 26.02.2005 12:14
fehler im script PHP Tipps 2004 1 27.07.2004 21:05
[Erledigt] Wo ist der Fehler im Script (MySQL mit PHP) PHP Tipps 2004 15 27.07.2004 09:25
script zum erstellen eines txt-dokumentes PHP Tipps 2004 4 11.07.2004 18:56
Fehler im Login Script PHP Tipps 2004 3 06.07.2004 20:37
Fehler in multilingualen Script PHP Tipps 2004 3 13.06.2004 20:39

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
\error when uploading; the file name is invalid, or the file is too big\, uber uplader create thumnail, warning: imagecopyresized(): invalid image dimensions in, script fehlermeldung erstellen, upload a valid jpeg or png file, image uploader erstellen, pic upload script erstellen html.de, uploader erstellen, images upload with thumbnail script, division by zero in pictur upload, warning: imagecopyresized(): supplied argument is not a valid image resource, if (file_exists ausgeben gif, jpg , png, celebritymarkt.de, gd2 warning: imagecreatetruecolor() : invalid image dimensions in, images upload script mit db, \error when uploading; the file name is invalid\, \error when uploading; the file name is invalid, or the file is too big, php update is not a valid png file, warning: division by zero in /var/www/web1/html/, bild upload script fehler index.php on line 92

Alle Zeitangaben in WEZ +2. Es ist jetzt 23:19 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.