[PHP & MySQL] beschriften eines bildes

Katinka
php:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
$neuname "$user.jpg";
$neuname2 "$bild_name-$nr.jpg";
$datei=$_FILES['Datei']['tmp_name'];
$move=move_uploaded_file($_FILES['Datei']['tmp_name'], "./upload/".$neuname);

if($move==true)
{
function thumb_popup($file$save$width$height$prop TRUE) {
    if(!function_exists("show_popup")) {
        function show_popup($original$thumb) {
            $infos = @getimagesize($original);
            $w $infos[0] + 40;
            $h $infos[1] + 40;
            $infos_th = @getimagesize($thumb);
        }
    }
    if(!file_exists($save) || @filemtime($thumb)< @filemtime($file)) {
        @unlink($save);
        $infos = @getimagesize($file);
        if($prop) {
            $iWidth $infos[0];
            $iHeight $infos[1];
            $iRatioW $width $iWidth;
            $iRatioH $height $iHeight;
            if ($iRatioW $iRatioH)
            {
            $iNewW $iWidth $iRatioW;
            $iNewH $iHeight $iRatioW;
            } else {
            $iNewW $iWidth $iRatioH;
            $iNewH $iHeight $iRatioH;
            }
        } else {
            $iNewW $width;
            $iNewH $height;
        }

        if($infos[2] == 2) {
            // Bild ist vom Typ jpg
            $imgA imagecreatefromjpeg($file);
            $imgB imagecreatetruecolor($iNewW,$iNewH);
            imagecopyresampled($imgB$imgA0000$iNewW,
                               $iNewH$infos[0], $infos[1]);
            imagejpeg($imgB$save);
            return show_popup($file$save);
        } elseif($infos[2] == 3) {
            // Bild ist vom Typ png
            $imgA imagecreatefrompng($file);
            $imgB imagecreatetruecolor($iNewW$iNewH);
            imagecopyresampled($imgB$imgA0000$iNewW,
                               $iNewH$infos[0], $infos[1]);
            imagepng($imgB$save);
            return show_popup($file$save);
        } else {
            return FALSE;
        }
    } else {
        return show_popup($file$save);
    }
}

 $from2 "./upload/$neuname";
 $to12 "./$neuname2";
 echo thumb_popup($from2$to12600600TRUE);

if($infos[2] == 2){//jpg
$im ImageCreateFromJPEG ("./$neuname2");
$col ImageColorAllocate ($im255255255);
ImageString($im266"Hochgeladen: $user"$col);
imagejpeg($im,"$neuname2");

$im ImageCreateFromJPEG ("./$neuname2");
$col ImageColorAllocate ($im000);
ImageString($im255"Hochgeladen: $user"$col);
imagejpeg($im,"$neuname2"); }

if($infos[2] == 3){//png
$im ImageCreateFromPNG ("./$neuname2");
$col ImageColorAllocate ($im255255255);
ImageString($im266"Hochgeladen: $user"$col);
imagepng($im,"$neuname2");

$im ImageCreateFromPNG ("./$neuname2");
$col ImageColorAllocate ($im000);
ImageString($im255"Hochgeladen: $user"$col);
imagepng($im,"$neuname2"); }


geht solang es jpg ist problem los Freude aber er verträgt kein png also kanns nit beschriften. obwohl ich das jetzt extra mit dem infos[2] sov ersucht hab... aber eigendlich müsste es ja so oder so gehen weil ich es vorher als jpg abspeichere/umspeichere....

hat jemand ne idee?
cll
du kannst ein .png meines Wissens nicht einfach beim Upload als .jpg speichern. Die Endung wird zwar ersetzt, aber damit ist die Datei kaputt, weil die Codierung nicht mehr passt
Katinka
Zitat:
Original von cll
du kannst ein .png meines Wissens nicht einfach beim Upload als .jpg speichern. Die Endung wird zwar ersetzt, aber damit ist die Datei kaputt, weil die Codierung nicht mehr passt


ironischerweise wird sie ebstens angezeigtFreude