resource id #6 foutmelding

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Elsa de Leeuw

Elsa de Leeuw

28/02/2011 21:08:10
Quote Anchor link
Hoi,

Ik heb een resource id#6 foutmelding en ik heb geen idee hoe ik deze eruit kan halen. De foto's worden wel geupload en in de database gezet.

Bedoeling van script is dus foto resizen en thumbnail maken. Daarna wordt het pad in de database opgeslagen. Dit lukt beiden goed. Alleen ik krijg die melding er niet uit.

Wie kan me helpen please???

Elsa

Het script:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
error_reporting(E_ALL);
//databaseverbinding
include "/include/db.inc.php";


$change="";



 define ("MAX_SIZE","1000");
 function
getExtension($str) {
         $i = strrpos($str,".");
         if (!$i) { return ""; }
         $l = strlen($str) - $i;
         $ext = substr($str,$i+1,$l);
         return $ext;
 }


 $errors=0;
  
 if($_SERVER["REQUEST_METHOD"] == "POST")
 {

     $image =$_FILES["file"]["name"];
    $uploadedfile = $_FILES['file']['tmp_name'];
    
 
     if ($image)
     {


         $filename = stripslashes($_FILES['file']['name']);
     
          $extension = getExtension($filename);
         $extension = strtolower($extension);
        
        
        
 if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif"))
         {

        
             $change='<div class="msgdiv">Unknown Image extension </div> ';
             $errors=1;
         }

         else
         {

 $size=filesize($_FILES['file']['tmp_name']);


if ($size > MAX_SIZE*1024)
{

    $change='<div class="msgdiv">You have exceeded the size limit! Uw foto wordt niet in de database opgeslagen.</div> ';
    $errors=1;
}



if($extension=="jpg" || $extension=="jpeg" )
{

$uploadedfile = $_FILES['file']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);

}

else if($extension=="png")
{

$uploadedfile = $_FILES['file']['tmp_name'];
$src = imagecreatefrompng($uploadedfile);

}

else
{
$src = imagecreatefromgif($uploadedfile);
}


echo $src;

list($width,$height)=getimagesize($uploadedfile);


$newwidth=300;
$newheight=($height/$width)*$newwidth;
$tmp=imagecreatetruecolor($newwidth,$newheight);


$newwidth1=100;
$newheight1=($height/$width)*$newwidth1;
$tmp1=imagecreatetruecolor($newwidth1,$newheight1);

imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);

imagecopyresampled($tmp1,$src,0,0,0,0,$newwidth1,$newheight1,$width,$height);


$filename = "images/". $_FILES['file']['name'];

$filename1 = "images/small/". $_FILES['file']['name'];



imagejpeg($tmp,$filename,100);

imagejpeg($tmp1,$filename1,100);

imagedestroy($src);
imagedestroy($tmp);
imagedestroy($tmp1);


}}

}


//If no errors registred, print the success message
 if(isset($_POST['submit']) && !$errors)
 {
    
     $onr=$_GET['onr'];
    
    
     $sql= "insert into image (onr, foto, thumb) VALUES ('$onr', '$filename', '$filename1')";
    if (!mysql_query($sql)) { // voer SQL code uit
echo "Helaas, uw bericht kan niet worden toegevoegd";

}

    echo $sql;
    $change=' <div class="msgdiv">Image Uploaded Successfully!</div>';


}

 
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta content="en-us" http-equiv="Content-Language">

<title>picture demo</title>

<link href=".css" media="screen, projection" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery_002.js"></script>
<script type="text/javascript" src="js/displaymsg.js"></script>
<script type="text/javascript" src="js/ajaxdelete.js"></script>


<style type="text/css">
.help
{
font-size:11px; color:#006600;
}
body {
color: #000000;
background-color:#999999 ;
background:#999999 fixed repeat top left;


font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;

}
.msgdiv{
width:759px;
padding-top:8px;
padding-bottom:8px;
background-color: #fff;
font-weight:bold;
font-size:18px;-moz-border-radius: 6px;-webkit-border-radius: 6px;
}
#container{width:763px;margin:0 auto;padding:3px 0;text-align:left;position:relative; -moz-border-radius: 6px;-webkit-border-radius: 6px; background-color:#FFFFFF }
</style>

</head><body>
<div align="center" id="err">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $change; ?>
</div>
<div id="space"></div>





<div id="container" >

<div id="con">



<table width="502" cellpadding="0" cellspacing="0" id="main">
<tbody>
<tr>
<td width="500" height="238" valign="top" id="main_right">

<div id="posts">
&nbsp;&nbsp;&nbsp;&nbsp;<img src="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $filename; ?>
" /> &nbsp;&nbsp;&nbsp;&nbsp;<img src="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $filename1; ?>
" />
<form method="POST" action="" enctype="multipart/form-data" name="form1">
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><Td style="height:25px">&nbsp;</Td></tr>
<tr>
<td width="150"><div align="right" class="titles">Picture
: </div></td>
<td width="350" align="left">
<div align="left">
<input size="25" name="file" type="file" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10pt" class="box"/>

</div></td>

</tr>
<tr><Td></Td>
<Td valign="top" height="35px" class="help">Image maximum size <b>1.000 </b>kb</span></Td>
</tr>
<tr><Td></Td><Td valign="top" height="35px"><input type="submit" id="mybut" value=" Upload " name="Submit"/></Td></tr>
<tr>
<td width="200">&nbsp;</td>
<td width="200"><table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="200" align="center"><div align="left"></div></td>
<td width="100">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
</form>




</div>




</td>

</tr>
</tbody>
</table>




</div>

</div>



</body></html>
 
PHP hulp

PHP hulp

28/11/2024 16:37:22
 

28/02/2011 21:24:26
Quote Anchor link
Kijk eens wat elke functie teruggeeft, vooral de functie op de regel die staat van de foutmelding.
 
Elsa de Leeuw

Elsa de Leeuw

28/02/2011 21:35:53
Quote Anchor link
ik krijg alleen resource id#6 melding, zonder dat er naar een regel verwezen wordt.
 
Tikkes C

Tikkes C

28/02/2011 22:24:18
Quote Anchor link
zet al even deze regel goed:
$sql= "insert into image (onr, foto, thumb) VALUES ('$onr', '$filename', '$filename1')";

(uiteraard moeten hier de variabelen buiten de "" gebracht worden.

Verder zie k niet direct iets mis...hmm...
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.