Jump to content

scmeeker

Members
  • Posts

    153
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Female

scmeeker's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Thanks SO much for that help. It pushed me in the right direction and I soon found a simple, easy way to upload my swf files with NO problem. I appreciate it!!
  2. Do you think the Image Resizer is causing a problem? I also tried setting the SWF as $_FILES["image_upload_box"]["type"] == "media/swf" with no luck. No transfer to the image file. Any suggestions??
  3. Okay...I tried it out towards the beginning and the end of the code as $image = $FILES["image_upload_box"]["type"]; Then at the very end I echoed the $image variable but nothing comes up when I test it. Any suggestions at what I'm not doing right?
  4. Thanks for that! Did you have a chance to look at the code? I'm so puzzled! I researched and it looked as though I could simply replace the jpeg file name with the SWF file name for the uploader. I don't know if its because it is image/swf...because its actually a movie file which is causing the problem? Any ideas?
  5. sorry...they've changed the tagging since I posted last. It used to be above where you type and I looked for it. Sorry! Do you simply put <?php at the beginning of the PHP code and ?> at the end for it to show up properly in the post?
  6. Trying to have my image uploader transfer up SWF files without any luck. It uploads the file name correctly but is not transferring the file itself to the file directory. It works fine with my regular images but just not with the SWF files. I've changed all occurences of JPG and replaced them with SWF. Help? Perhaps I'm missing something? Thanks for your help! <?php $item_image = $_FILES['image_upload_box']['name']; $item_id = $_GET['id']; $sql="UPDATE imagetable SET sp_image='$item_image' WHERE id = '$item_id'"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } else { // 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/swf" || $_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"] < 400000000)) { // some settings $max_upload_width = 800; $max_upload_height = 300; // 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/swf" || $_FILES["image_upload_box"]["type"] == "image/swf"){ $image_source = imagecreatefromswf($_FILES["image_upload_box"]["name"]); } // if uploaded image was GIF if($_FILES["image_upload_box"]["type"] == "image/gif"){ $image_source = imagecreatefromgif($_FILES["image_upload_box"]["name"]); } // BMP doesn't 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"]["name"]); } // if uploaded image was PNG if($_FILES["image_upload_box"]["type"] == "image/x-png"){ $image_source = imagecreatefrompng($_FILES["image_upload_box"]["name"]); } $remote_file = "image_files/".$_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 = imagecreatefromswf($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); MOD EDIT: . . . BBCode tags added.
  7. That did it! Thank you SO much! I appreciate your feedback.
  8. found it...finally! It was the fact that there were no quotes around the variable 'username' and so on. It's working fine now. $username = mysql_real_escape_string($_POST[username]); Thanks for your help!
  9. Yes, it's giving me this error: "Warning: Cannot modify header information - headers already sent " with the line #.
  10. When I tested it out on my home server, it works fine but is not working "live." That's where its giving me problems. I have - ini_set('display_errors', 0); at the top of the page but no errors show up. Is there something else I should do to show the errors? Thanks.
  11. Perhaps I need another set of eyes on this but after Inserting into the Table (which that works fine), its not going to the next page: header("location:finalize.php"); It's inserting the new user, then staying on a blank page and not moving on to "finalize.php." Here is the code from the page: <?php session_start (); ?> <?php include('connect.php'); $username = mysql_real_escape_string($_POST[username]); $first_name = mysql_real_escape_string($_POST[first_name]); $last_name = mysql_real_escape_string($_POST[last_name]); $password = mysql_real_escape_string($_POST[password]); $membership = mysql_real_escape_string($_POST[membership]); $level = mysql_real_escape_string($_POST[level]); $terms = mysql_real_escape_string($_POST[terms]); $sql2="INSERT INTO user (first_name, last_name, username, password, membership, level, terms, date) VALUES ('$first_name', '$last_name', '$username', '$password', '$membership', '$level', '$terms', CURDATE())"; if (!mysql_query($sql2)) { die('Error: ' . mysql_error()); }else { header("location:finalize.php"); } ?>
  12. I'm still stumped on this one and would really appreciate the help. I'm still researching but without any luck. Thanks!
  13. What I'm really trying to figure out is how I get this to loop around and add all the selected entries instead of only the last one. Thanks!
  14. The information is drawn in from a table into a form that the user will click submit and all the rows will be inputted into the table with their username association. With this form, its only inputting the last row and not all of them. You're help is much appreciated! Here is the form in the PHP area: while($row=mysql_fetch_array($get_items_sql)){ $name =$row['item']; $date = ($row['expiration_date']); $exp_date = date('M d Y', strtotime($row['expiration_date'])); $content .= ""; $content .="<table width=\"450\" border=\"0\"><tr><td width=\"200\"><span class=\"anotherfont\"><input name=\"item[]\" type=\"hidden\" value=\"$name\" id=\"item[]\">$name</span></td><td width=\"200\"><span class=\"greenfont\"><input name=\"expiration_date[]\" type=\"hidden\" value=\"$date\" id=\"expiration_date[]\">$exp_date</span><input name=\"username[]\" type=\"hidden\" value=\"$username\" id=\"username[]\"/> </td></tr><br /></table>"; $content .= "\n"; } $content .= "</ul>\n"; Then below is part of the HTML Form with $content referenced: <form action="add_select.php?source_id=<?php echo $coupon_source ?>" method="post" enctype="multipart/form-data" name="add_new" id="add_new"> <?php echo $content ?> <input name="SUBMIT" type="submit" value="submit" /></form><br /> Then here is the section from the "add_select.php" file from the form: include('connect.php'); foreach($_POST['item'] as $row=>$item) { $Item_name=$item; $expiration_date=$_POST['expiration_date'][$row]; $username=$_POST['username'][$row]; } foreach($_POST['item'] as $row=>$item) { $Item_name=mysql_real_escape_string($item); $expiration_date=mysql_real_escape_string($_POST['expiration_date'][$row]); $username=mysql_real_escape_string($_POST['username'][$row]); } $sql2="INSERT INTO place (item, expiration_date, username) VALUES ('$Item_name', '$expiration_date', '$username')"; if (!mysql_query($sql2)) { die('Error: ' . mysql_error()); }else { header("location:insert_complete.php"); }
  15. This resizer works fine except I would like it to save the original image AND the thumbnail. Right now its only saving the cropped thumbnail. It's seems simple enough but I've tried several different ways but can't get it to work. I would appreciate your help. define( 'DESIRED_IMAGE_WIDTH', 150 ); define( 'DESIRED_IMAGE_HEIGHT', 150 ); $source_path = $_FILES[ 'thumb' ][ 'tmp_name' ]; $timestamp = time(); $target = "image_files/".$imagename; move_uploaded_file($source, $target); // // Add file validation code here // list( $source_width, $source_height, $source_type ) = getimagesize( $source_path ); switch ( $source_type ) { case IMAGETYPE_GIF: $source_gdim = imagecreatefromgif( $source_path ); break; case IMAGETYPE_JPEG: $source_gdim = imagecreatefromjpeg( $source_path ); break; case IMAGETYPE_PNG: $source_gdim = imagecreatefrompng( $source_path ); break; } $source_aspect_ratio = $source_width / $source_height; $desired_aspect_ratio = DESIRED_IMAGE_WIDTH / DESIRED_IMAGE_HEIGHT; if ( $source_aspect_ratio > $desired_aspect_ratio ) { // // Triggered when source image is wider // $temp_height = DESIRED_IMAGE_HEIGHT; $temp_width = ( int ) ( DESIRED_IMAGE_HEIGHT * $source_aspect_ratio ); } else { // // Triggered otherwise (i.e. source image is similar or taller) // $temp_width = DESIRED_IMAGE_WIDTH; $temp_height = ( int ) ( DESIRED_IMAGE_WIDTH / $source_aspect_ratio ); } // // Resize the image into a temporary GD image // $temp_gdim = imagecreatetruecolor( $temp_width, $temp_height ); imagecopyresampled( $temp_gdim, $source_gdim, 0, 0, 0, 0, $temp_width, $temp_height, $source_width, $source_height ); // // Copy cropped region from temporary image into the desired GD image // $x0 = ( $temp_width - DESIRED_IMAGE_WIDTH ) / 2; $y0 = ( $temp_height - DESIRED_IMAGE_HEIGHT ) / 2; $desired_gdim = imagecreatetruecolor( DESIRED_IMAGE_WIDTH, DESIRED_IMAGE_HEIGHT ); imagecopy( $desired_gdim, $temp_gdim, 0, 0, $x0, $y0, DESIRED_IMAGE_WIDTH, DESIRED_IMAGE_HEIGHT ); // // Render the image // Alternatively, you can save the image in file-system or database // header( 'Content-type: image/jpeg' ); imagejpeg( $desired_gdim, "image_files/" . $timestamp . $_FILES["thumb"]["name"] );
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.