ik krijg volgende melding na het uploaden van een foto, ook komt de foto niet in de juiste map:
dit is de code van de bewuste pagina die word geincluded in _foto.php:
dit is de code van de _foto.php pagina:
ik heb dit ooit nog gehad en toen was het probleem dat mijn eerste <?php niet op de eerste lijn stond maar nu blijkbaar niet . ik heb ook de eerste php weggedaan maar dat geeft nog een slechter resultaat.
heeft iemand raad?
HTML:
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\modo-testsite\private\_foto.php:97) in C:\xampp\htdocs\modo-testsite\private\submit.php on line 77
dit is de code van de bewuste pagina die word geincluded in _foto.php:
PHP:
<?php ini_set("memory_limit", "200000000"); // for large images so that we do not get "Allowed memory exhausted"?>
<?php
// upload the file
if ((isset($_POST["submitted_form"])) && ($_POST["submitted_form"] == "image_upload_form")) {
// file needs to be jpg,gif,bmp,x-png and 4 MB max
if (($_FILES["image_upload_box"]["type"] == "image/jpeg" || $_FILES["image_upload_box"]["type"] == "image/pjpeg" || $_FILES["image_upload_box"]["type"] == "image/gif" || $_FILES["image_upload_box"]["type"] == "image/x-png") && ($_FILES["image_upload_box"]["size"] < 2500000))
{
// some settings
$max_upload_width = 2592;
$max_upload_height = 1944;
// if user chosed properly then scale down the image according to user preferances
if(isset($_REQUEST['max_width_box']) and $_REQUEST['max_width_box']!='' and $_REQUEST['max_width_box']<=$max_upload_width){
$max_upload_width = $_REQUEST['max_width_box'];
}
if(isset($_REQUEST['max_height_box']) and $_REQUEST['max_height_box']!='' and $_REQUEST['max_height_box']<=$max_upload_height){
$max_upload_height = $_REQUEST['max_height_box'];
}
// if uploaded image was JPG/JPEG
if($_FILES["image_upload_box"]["type"] == "image/jpeg" || $_FILES["image_upload_box"]["type"] == "image/pjpeg"){
$image_source = imagecreatefromjpeg($_FILES["image_upload_box"]["tmp_name"]);
}
// if uploaded image was GIF
if($_FILES["image_upload_box"]["type"] == "image/gif"){
$image_source = imagecreatefromgif($_FILES["image_upload_box"]["tmp_name"]);
}
// BMP doesnt seem to be supported so remove it form above image type test (reject bmps)
// if uploaded image was BMP
if($_FILES["image_upload_box"]["type"] == "image/bmp"){
$image_source = imagecreatefromwbmp($_FILES["image_upload_box"]["tmp_name"]);
}
// if uploaded image was PNG
if($_FILES["image_upload_box"]["type"] == "image/x-png"){
$image_source = imagecreatefrompng($_FILES["image_upload_box"]["tmp_name"]);
}
$remote_file = "./fotos/".$_FILES["image_upload_box"]["name"];
imagejpeg($image_source,$remote_file,100);
chmod($remote_file,0644);
// get width and height of original image
list($image_width, $image_height) = getimagesize($remote_file);
if($image_width>$max_upload_width || $image_height >$max_upload_height){
$proportions = $image_width/$image_height;
if($image_width>$image_height){
$new_width = $max_upload_width;
$new_height = round($max_upload_width/$proportions);
}
else{
$new_height = $max_upload_height;
$new_width = round($max_upload_height*$proportions);
}
$new_image = imagecreatetruecolor($new_width , $new_height);
$image_source = imagecreatefromjpeg($remote_file);
imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
imagejpeg($new_image,$remote_file,100);
imagedestroy($new_image);
}
imagedestroy($image_source);
header("Location: ./_foto.php?upload_message=Foto succesvol verstuurd &upload_message_type=success&show_image=".$_FILES["image_upload_box"]["name"]);
exit;
}
else{
header("Location: ./_foto.php?upload_message=make sure the file is jpg, gif or png and that is smaller than 2,5MB&upload_message_type=error");
exit;
}
}
?>
<?php if(isset($_REQUEST['upload_message'])){?>
<div class="upload_message_<?php echo $_REQUEST['upload_message_type'];?>">
<?php echo htmlentities($_REQUEST['upload_message']);?>
</div>
<?php }?>
<form action="_foto.php" method="post" enctype="multipart/form-data" name="image_upload_form" id="image_upload_form" style="margin-bottom:0px;">
<label>Fotos mogen maximum 2,5MB zijn en het bestandsformaat mag jpg, gif of png zijn:</label><br />
<input name="image_upload_box" type="file" id="image_upload_box" size="40" />
<input type="submit" name="submit" value="Upload foto" />
<br />
<br />
<label> </label>
<br />
<input name="max_width_box" type="hidden" id="max_width_box" value="448" size="4">
<input name="max_height_box" type="hidden" id="max_height_box" value="336" size="4">
<br />
<br />
<p>
<strong>Voorbeeld:</strong><br />
</p>
<input name="submitted_form" type="hidden" id="submitted_form" value="image_upload_form" />
</form>
<?php if(isset($_REQUEST['show_image']) and $_REQUEST['show_image']!=''){?>
<p>
<img src="/fotos<?php echo $_REQUEST['show_image'];?>" />
</p>
<?php }?>
dit is de code van de _foto.php pagina:
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../ike/modo.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../slidshow.js"></script>
<script type="text/javascript">
<!--
SLIDES = new slideshow("SLIDES");
// Create some slides and add custom filters for Microsoft IE
SLIDES.add_slide(s = new slide('../images/0.jpg'));
s.filter = 'progid:DXImageTransform.Microsoft.Pixelate()';
SLIDES.add_slide(s = new slide('../images/1.jpg'));
s.filter = 'progid:DXImageTransform.Microsoft.Pixelate()';
SLIDES.add_slide(s = new slide('../images/2.jpg'));
s.filter = 'progid:DXImageTransform.Microsoft.Fade()';
SLIDES.add_slide(s = new slide('../images/3.jpg'));
s.filter = 'progid:DXImageTransform.Microsoft.Barn()';
SLIDES.add_slide(s = new slide('../images/4.jpg'));
s.filter = 'progid:DXImageTransform.Microsoft.Barn()';
SLIDES.add_slide(s = new slide('../images/5.jpg'));
s.filter = 'progid:DXImageTransform.Microsoft.Barn()';
SLIDES.add_slide(s = new slide('../images/6.jpg'));
s.filter = 'progid:DXImageTransform.Microsoft.Barn()';
SLIDES.add_slide(s = new slide('../images/7.jpg'));
s.filter = 'progid:DXImageTransform.Microsoft.Barn()';
//-->
</script>
<title>MODO eetcafé: Admin</title>
</head>
<body onload="SLIDES.play();">
<div id="box">
<div id="copyright">
<a href='../i_login.php'>© 2009 - Modo eetcafé</a> </div>
<div id="kop">
</div>
<div id="inhoud">
<div id="inhoudLinks">
<!-- InstanceBeginEditable name="links" -->
<ul>
<li><a href='_index.php'>Modo eetcafé</a></li>
<li><a href='_info.php'>Info</a></li><li><a href='_menu.php'>Menu</a></li><li><a href='_suggestie.php'>Suggestie</a></li><li><a href='_foto.php' class='hier'>Fotogalerij</a></li><li><a href='_plan.php'>Plan</a></li><li><a href='_reservatie.php'>Reservatie</a></li><li><a href='_cadeaubon.php'>Cadeaubon</a></li><li><a href='../index.php'>Uitloggen</a></li> </ul>
<img name="SLIDESIMG" src="../images/0.jpg" border="0" style="filter:progid:DXImageTransform.Microsoft.Fade()" alt="Slideshow image" />
<script type="text/javascript">
<!--
if (document.images) {
SLIDES.image = document.images.SLIDESIMG;
// Create a function to ramp up the image opacity in Mozilla
var fadein_opacity = 0.04;
var fadein_img = SLIDES.image;
function fadein(opacity) {
if (typeof opacity != 'undefined') { fadein_opacity = opacity; }
if (fadein_opacity < 0.99 && fadein_img && fadein_img.style &&
typeof fadein_img.style.MozOpacity != 'undefined') {
fadein_opacity += .05;
fadein_img.style.MozOpacity = fadein_opacity;
setTimeout("fadein()", 50);
}
}
// Tell the slideshow to call our function whenever the slide is changed
SLIDES.post_update_hook = function() { fadein(0.04); }
}
//-->
</script>
</div>
<div id="inhoudRechts">
<!-- InstanceBeginEditable name="rechts" -->
<div class='titel'>Modo eetcafé</div>
<?php include('./submit.php'); ?>
<div> </div>
<p> </p> <!-- InstanceEndEditable -->
</div>
<br class="clear" />
</div>
<div id="voet">
</div>
</div>
</body>
</html>
ik heb dit ooit nog gehad en toen was het probleem dat mijn eerste <?php niet op de eerste lijn stond maar nu blijkbaar niet . ik heb ook de eerste php weggedaan maar dat geeft nog een slechter resultaat.
heeft iemand raad?