adam291086 Posted October 1, 2007 Share Posted October 1, 2007 I have an online gallery running. The problem is that the images wont load into the folders on my webserver and my code echos the error message. ''ERROR:loadImage'' I have checked all the database connections and they work. Any ideas on how to solve this problem? <?php include("GallerySizer.php"); include("config.php"); DEFINE("IMAGE_FULL", '../photos/'); //database connect $db_server ="is correct"; $db_user = "is correct"; $db_pass = "is correct"; $db_name = "is correct"; $con = mysql_connect("$db_server","$db_user","$db_pass"); // Album cover $cover = $_FILES['image']['name'][$_POST['album_cover']]; if (!$_REQUEST['process']){ echo("Error! No images chosen for processing. <br />"); echo("Click <a href='index.php'>here</a> to start processing your images."); die(); } elseif (!$_POST['album_id']){ echo("No album selected. Please <a href=\"\">choose an album</a> to upload images to."); die(); } else { for($i = 0; $i < count($_FILES['image']['tmp_name']); $i++){ $fileName = $_FILES['image']['name'][$i]; copy($_FILES['image']['tmp_name'][$i], IMAGE_FULL . $fileName); $thumb = new GallerySizer(); if($thumb->getLocation(IMAGE_FULL . $fileName)){ if($thumb->loadImage()){ echo("Still here!"); if($thumb->getSize()){ if($thumb->setThumbnail()){ if($thumb->copyThumbImage()){ if($thumb->resizeImage()) { $thumb->copyResizedImage(); }else{die("ERROR:resizeImage");} }else{die("ERROR:copyThumbImage");} }else{die("ERROR:setThumbnail");} }else{die("ERROR:getSize");} }else{die("ERROR:loadImage");} }else{ echo("Invalid image/file has been uploaded. Please upload a supported file-type (JPEG/PNG)"); unlink(IMAGE_FULL . $fileName); die(); } insert_location($thumb); } } function insert_location($thumb_obj) { $image_location = $thumb_obj->getImageLocation(); $thumb_location = $thumb_obj->getThumbLocation(); // If image matches cover selection, update album cover if($cover == $_FILES['image']['name'][$i]){ $sql = "UPDATE albums SET album_cover = '" . $thumb_location . "' WHERE album_id = " . $_POST['album_id']; $result = @mysql_query($sql) or die("Error inserting records: " . mysql_error()); } mysql_select_db("is correct", $con); $sql = ("INSERT INTO photos (photo_id, photo_title, photo_desc, photo_date, photo_location, thumbnail_location,album_id) VALUES('0', '$_POST[photo_title]', '$_POST[photo_desc]', 'NOW()', '$image_location', '$thumb_location', '$_POST[album_id]')"); $result = mysql_query($sql) or die("Error inserting record(s) into the database: " . mysql_error()); if ($result){ echo("Images successfully converted and stored! <br />Click <a href='index.html'>here</a> to continue."); } } ?> Link to comment https://forums.phpfreaks.com/topic/71329-solved-why-wont-my-upload-page-work/ Share on other sites More sharing options...
~n[EO]n~ Posted October 1, 2007 Share Posted October 1, 2007 have u given write access to your folder online ??? chmod 777 Link to comment https://forums.phpfreaks.com/topic/71329-solved-why-wont-my-upload-page-work/#findComment-358901 Share on other sites More sharing options...
adam291086 Posted October 1, 2007 Author Share Posted October 1, 2007 I just made a folder with my ftp uploader. How can i check this? I am new and have no idea Link to comment https://forums.phpfreaks.com/topic/71329-solved-why-wont-my-upload-page-work/#findComment-358904 Share on other sites More sharing options...
adam291086 Posted October 1, 2007 Author Share Posted October 1, 2007 I have set up the user permission on both files, but i still get the same result Link to comment https://forums.phpfreaks.com/topic/71329-solved-why-wont-my-upload-page-work/#findComment-358908 Share on other sites More sharing options...
~n[EO]n~ Posted October 1, 2007 Share Posted October 1, 2007 You must set chmod to 777 to give write acess to the folder where u upload images. I use WS FTP pro, in it there is Operations > FTP commands > CHMOD , there must be in your FTP program too. Link to comment https://forums.phpfreaks.com/topic/71329-solved-why-wont-my-upload-page-work/#findComment-358915 Share on other sites More sharing options...
adam291086 Posted October 1, 2007 Author Share Posted October 1, 2007 I have set chmod on both folders to 777 but i am still getting the echoed message ''ERROR:loadImage'' Link to comment https://forums.phpfreaks.com/topic/71329-solved-why-wont-my-upload-page-work/#findComment-358917 Share on other sites More sharing options...
shocker-z Posted October 1, 2007 Share Posted October 1, 2007 try this to see what it echo's back <?php include("GallerySizer.php"); include("config.php"); DEFINE("IMAGE_FULL", '../photos/'); //database connect $db_server ="is correct"; $db_user = "is correct"; $db_pass = "is correct"; $db_name = "is correct"; $con = mysql_connect("$db_server","$db_user","$db_pass"); // Album cover $cover = $_FILES['image']['name'][$_POST['album_cover']]; if (!$_REQUEST['process']){ echo("Error! No images chosen for processing. <br />"); echo("Click <a href='index.php'>here</a> to start processing your images."); die(); } elseif (!$_POST['album_id']){ echo("No album selected. Please <a href=\"\">choose an album</a> to upload images to."); die(); } else { for($i = 0; $i < count($_FILES['image']['tmp_name']); $i++){ $fileName = $_FILES['image']['name'][$i]; copy($_FILES['image']['tmp_name'][$i], IMAGE_FULL . $fileName); echo 'tmp img: '.$_FILES['image']['tmp_name'][$i]; echo '<Br>img name: '$fileName; $thumb = new GallerySizer(); if($thumb->getLocation(IMAGE_FULL . $fileName)){ if($thumb->loadImage()){ echo("Still here!"); if($thumb->getSize()){ if($thumb->setThumbnail()){ if($thumb->copyThumbImage()){ if($thumb->resizeImage()) { $thumb->copyResizedImage(); }else{die("ERROR:resizeImage");} }else{die("ERROR:copyThumbImage");} }else{die("ERROR:setThumbnail");} }else{die("ERROR:getSize");} }else{die("ERROR:loadImage");} }else{ echo("Invalid image/file has been uploaded. Please upload a supported file-type (JPEG/PNG)"); unlink(IMAGE_FULL . $fileName); die(); } } } ?> i have ripped out the actual functions because i just want to check that your image names are being passed over. Liam Link to comment https://forums.phpfreaks.com/topic/71329-solved-why-wont-my-upload-page-work/#findComment-358921 Share on other sites More sharing options...
adam291086 Posted October 1, 2007 Author Share Posted October 1, 2007 As i am new i dont understand what you have done and can't correct the error message below Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' in /homepages/12/d214897219/htdocs/adam/create_thumbnails.php on line 28 Link to comment https://forums.phpfreaks.com/topic/71329-solved-why-wont-my-upload-page-work/#findComment-358924 Share on other sites More sharing options...
adam291086 Posted October 1, 2007 Author Share Posted October 1, 2007 I managed to fix the code. It took a little while. What i get echoed is this tmp img: /tmp/phpJIi5W8 img name: tagflap_280907_174544.jpgERROR:loadImage Link to comment https://forums.phpfreaks.com/topic/71329-solved-why-wont-my-upload-page-work/#findComment-358925 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.