ik gebruik de volgende code om een stukje test in een plaatje van mijn fotoscript te krijgen, nou geeft ie steeds de zelfde error en ik snap niet wat er fout is.
het gaat mis bij het pad naar de image maar als ik het pad direct in de variabele zet pakt ie hem ook niet, ofwel absoluut en relatief doet ie het niet.. iemand enig idee?
het gaat dus fout bij de if (file_exist()) functie
als ik het adres die bij de foutmelding gegeven wordt direct in mij browser plak laat ie wel de foto zien
het gaat mis bij het pad naar de image maar als ik het pad direct in de variabele zet pakt ie hem ook niet, ofwel absoluut en relatief doet ie het niet.. iemand enig idee?
het gaat dus fout bij de if (file_exist()) functie
als ik het adres die bij de foutmelding gegeven wordt direct in mij browser plak laat ie wel de foto zien
code:
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
| <?php function write_text($picture) { // Set the static variables (discussed in steps 2 and 3) $font_file = $_SERVER[DOCUMENT_ROOT]."verdana.ttf"; $font_size = 10; $angle = 0; $text = "© www.studentenfeesten.net"; $g_srcfile=$picture; $pathdata = pathinfo($picture); $ext = strtolower($pathdata['extension']); if ($ext == 'jpeg') $ext = 'jpg'; if(file_exists($g_srcfile)) { switch($ext) { case 'jpg': $im_size = getimagesize($g_srcfile); break; case 'gif': $im_size = getimagesize($g_srcfile); break; case 'png': $im_size = getimagesize($g_srcfile); break; } $image_width = $im_size[0]; $image_height = $im_size[1]; $im = imagecreate($image_width, $image_height); $white = imagecolorallocate($im, 255, 255, 255); $im2 = imagecreatefromjpeg($img); imagecopy($im, $im2, 0, 0, 0, 0, $image_width, $image_height); imagedestroy($im2); // Position the text $bounding_box = imagettfbbox($font_size, 0, $font_file, $text); $x_start = $image_width - $bounding_box[2] - $bounding_box[0] - 10; $y_start = $image_height - 10; // Write the text to the image imagettftext($im, $font_size, $angle, $x_start, $y_start, $white, $font_file, $text); // Create and then destroy the image header("Content-type: image/jpeg"); imagejpeg($im); imagedestroy($im); } else { echo"fout bestand bestaat niet<br>"; print($picture); } } ?> |
[ Voor 8% gewijzigd door Verwijderd op 02-03-2004 18:12 ]