Ik probeer via een form een plaatje in een database te mikken...
script:
Uitleesscript:
Uitkomst als ik het plaatje wil bekijken:
Resource id #18
in de database staat wel [BLOB - 15 Bytes]
Dus naar mijn mening staat er toch iets in...
Wie kan me helpen....
script:
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
| <? function img_to_db($image,$tablename,$maxthumbwidth,$maxthumbheight,$maxoriginalwidth,$maxoriginalheight) { // Thumb Maken $maxX = $maxthumbwidth; $maxY = $maxthumbheight; $imgsize = getimagesize($image); switch($imgsize[2]) { case 1: $timg = imageCreateFromGIF($image); $type = "gif"; break; case 2: $timg = imageCreateFromJPEG($image); $type = "jpg"; break; case 3: $timg = imageCreateFromPNG($image); $type = "png"; break; } $type = "jpg"; $imgX = $imgsize[0]; $imgY = $imgsize[1]; $_X = $imgX/$maxX * 100; $_Y = $imgY/$maxY * 100; if((100-$_X) < (100-$_Y)) { $_K = $_X; } else { $_K = $_Y; } $newX = floor($imgX/$_K * 100); $newY = floor($imgY/$_K * 100); $imgh = imageCreateTrueColor($newX, $newY); imagecopyresized($imgh, $timg, 0,0,0,0,$newX,$newY,$imgX,$imgY); //$db_thumb = ImageJPEG($imgh,"",100); //$fullfile = fread(fopen($db_thumb,"r"),filesize($db_thumb)); //$coded = chunk_split(base64_encode($db_thumb)); $coded = addslashes($imgh); mysql_query("INSERT INTO ".$tablename." (img_small) VALUES('".$coded."')"); } ?> |
Uitleesscript:
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| <? define("INCMS", "TRUE"); // Extra beveiliging require("../includes/settings.php"); header("Content-type: image/jpeg"); if ($_GET['s'] == "t") { $size = "img_small"; } else { $size = "img_large"; } $imageq = mysql_query("SELECT * FROM ".$_GET['t']." WHERE id='".$_GET['id']."'"); $row = mysql_fetch_array($imageq); $image = $row["".$size.""]; echo("".$image.""); ?> |
Uitkomst als ik het plaatje wil bekijken:
Resource id #18
in de database staat wel [BLOB - 15 Bytes]
Dus naar mijn mening staat er toch iets in...
Wie kan me helpen....