glow Posted June 12, 2008 Share Posted June 12, 2008 Hi everyone My question might be a real simple one but I'm afraid that I'm very new to php. I',ll try to explain briefly what i'm trying to do. I have this community flash image gallery script currently it just basically uploads images. I'd like to make it so the user has the option to edit the images prior to upload. So I found this "Fotoflexer" (http://fotoflexer.com/api.php) image editor API wish promises to be really simple to install, but I've stumbled upon a problem It is asking to simply fill in the image to be edited url and the url that will be called when the user is finished editing. Now all of my logic tells me that the URL of the image to be edited is unknown being that is being upload by the users from who knows where. this is the code for the script <?php // Parse paramters to get Image and thumbnail urls $image = $_GET['image']; $thumb = $_GET['thumb']; // Verify that the URL begins with "http://fotos.fotoflexer.com" // This step is used to ensure that the image is in authentic if (strpos($image, "http://fotos.fotoflexer.com") != 0){ //Handle the error: echo "Invalid Origin"; exit; } if (strpos($thumb, "http://fotos.fotoflexer.com") != 0){ //Handle the error: echo "Invalid Origin"; exit; } // Verify that the file is an image $headers = get_headers($image, 1); $content_type = explode("/", $header[Content-Type]); if ($content_type[0] != "image"){ //Handle the error echo "Invalid File Type"; exit; } $headers = get_headers($thumb, 1); $content_type = explode("/", $header[Content-Type]); if ($content_type[0] != "image"){ //Handle the error echo "Invalid File Type"; exit; } // Grab the image type (png or jpeg) $file_type = $content_type[1]; // Set the local file path for the image and thumbnail $image_path = "/path/to/images/image_name." . $file_type; $thumb_path = "/path/to/thumbnails/thumbnail_name." . $file_type; // Image source and content have been verified, and a location has been set. // Now copy the images to the local server. copy($image,$image_path); copy($thumb,$thumb_path); // Both image and thumb are on your server at the location specified! // Optional: // if this is is an intermediate page, you can now setup your server state // and redirect /* header("Location:Path/AnotherPage.html"); */ ?> I just don't get how I can implement this a multiuser enviroment when it is asking for an image specific location, there are many users with many image folders and new ones always created. anyways if anyone could please help me with this this is my current image upload php code. 0); else if (strpos($_REQUEST[del],$upload_dir) === false); else if (substr($_REQUEST[del],0,6)==$upload_dir) { unlink($_REQUEST[del]); print ""; } } else if ($_FILES['userfile']) { $file_type = $_FILES['userfile']['type']; $file_name = $_FILES['userfile']['name']; $file_ext = strtolower(substr($file_name,strrpos($file_name,"."))); //File Size Check if ( $_FILES['userfile']['size'] > $MAX_SIZE) $message = "The file size is over 2MB."; //File Extension Check else if (!in_array($file_ext, $FILE_EXTS)) $message = "Sorry, $file_name($file_type) is not allowed to be uploaded."; else $message = do_upload($upload_dir, $upload_url, $image, $upcheck); print ""; } else if (!$_FILES['userfile']); else $message = "Invalid File Specified."; / * List Files / $handle=opendir($upload_dir); $filelist = ""; while ($file = readdir($handle)) { if(!is_dir($file) && !is_link($file)) { $filelist .= "".$file.""; if ($DELETABLE) $filelist .= " x"; $filelist .= " ".date("d-m H:i", filemtime($upload_dir.$file)) .""; $filelist .=""; } } // Delete File if ($delete_file) { if ($upcheck == "ok"){ $d = $image; unlink ("$upload_url$d"); echo "File Deleted!"; exit; } } function do_upload($upload_dir, $upload_url, $image, $upcheck) { if ($upcheck == "ok"){ $temp_name = $_FILES['userfile']['tmp_name']; $file_name = $_FILES['userfile']['name']; $file_name = str_replace("\","",$file_name); $file_name = str_replace("'","",$file_name); $file_path = $upload_dir.$image; //File Name Check if ( $file_name =="") { $message = "Invalid File Name Specified"; return $message; } $result = move_uploaded_file($temp_name, $file_path); if (!chmod($file_path,0777)) $message = "change permission to 777 failed."; else $message = ($result)?"$file_name uploaded successfully." : "Somthing is wrong with uploading a file."; echo "UPLOAD WAS SUCCESSFUL!Click Here to close this window "; exit; return $message; } } if ($upcheck == "ok"){ ?> Upload File <input type="hidden" name="image" value=""> <INPUT TYPE="hidden" name="userid" value=""> <INPUT TYPE="hidden" name="password" value=""> Link to comment https://forums.phpfreaks.com/topic/109942-photo-editor-api-intergration/ Share on other sites More sharing options...
paulman888888 Posted June 12, 2008 Share Posted June 12, 2008 read there help information. Its more there side not php. Link to comment https://forums.phpfreaks.com/topic/109942-photo-editor-api-intergration/#findComment-564238 Share on other sites More sharing options...
glow Posted June 12, 2008 Author Share Posted June 12, 2008 I'm sorry ,but isn't this php code I just posted? besides I wouldn't be here if their board would be of any help nor their reading material. Link to comment https://forums.phpfreaks.com/topic/109942-photo-editor-api-intergration/#findComment-564364 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.