Jump to content

buildakicker

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Everything posted by buildakicker

  1. Well I guess it's more like a Dimensions problem... 3000x3000 won't work, but 3000x1500 will... hmmmm!
  2. So I see that there is a memory issue with it. So how does one go about dealing with XL images?
  3. Hello, I have this script running: <?php //include("include/session.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" /> <title>Add an Image to Gallery</title> <link href="../../include/stylee.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrap"> <div id="content"> <form enctype="multipart/form-data" action="<? $_SERVER['PHP_SELF'] ?>" method="post"> <fieldset title="Add Images and Descriptions"> <legend>Add Images and Descriptions</legend> <p> Choose a file to upload: <br /> <input name="image" type="file" /> </p> <p>Give the Image a Short Description<br /> <input name="ushortdesc" type="text" size="60" maxlength="75" /> </p> <p>Give the Image a Long Description<br /> <textarea name="ulongdesc" cols="60" rows="10"></textarea> </p> <p>Where does the Image Link to?<br /> <input name="uimglink" type="text" value="http://www.yoursite.com/yourstore/or..." size="60" /> </p> <p> <input type="submit" name="upload" value="Upload" /> </p> </fieldset> </form> </div> <div id="report"> <?php //function createThumbs( $pathToImages, $pathToThumbs, $thumbWidth ) //{ // // open the directory // $dir = opendir( $pathToImages ); // // // loop through it, looking for any/all JPG files: // while (false !== ($fname = readdir( $dir ))) { // // parse path for the extension // $info = pathinfo($pathToImages . $fname); // // continue only if this is a JPEG image // if ( strtolower($info['extension']) == 'jpg' ) // { // echo "Creating thumbnail for {$fname} <br />"; // // // load image and get image size // $img = imagecreatefromjpeg( "{$pathToImages}{$fname}" ); // $width = imagesx( $img ); // $height = imagesy( $img ); // // // calculate thumbnail size // $new_width = $thumbWidth; // $new_height = floor( $height * ( $thumbWidth / $width ) ); // // // create a new temporary image // $tmp_img = imagecreatetruecolor( $new_width, $new_height ); // // // copy and resize old image into new image - for gd-1 version // //imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); // //randys alteration for gd-2 version // imagecopyresampled( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); // // // save thumbnail into a file // imagejpeg( $tmp_img, "{$pathToThumbs}{$fname}" ); // } // } // // close the directory // closedir( $dir ); //} // // call createThumb function and pass to it as parameters the path //// to the directory that contains images, the path to the directory //// in which thumbnails will be placed and the thumbnail's width. //// We are assuming that the path will be a relative path working //// both in the filesystem, and through the web for links //createThumbs("images/","images/thumbs/",100); //echo "<h2>All Done!</h2>"; if(isset($_POST['upload'])) { $size = 50; // the thumbnail height $filedir = 'images/'; // the directory for the original image $thumbdir = 'thumbs/'; // the directory for the thumbnail image $prefix = 'thumb_'; // the prefix to be added to the original name $maxfile = '2100000'; $mode = '0666'; $userfile_name = $_FILES['image']['name']; $userfile_tmp = $_FILES['image']['tmp_name']; $userfile_size = $_FILES['image']['size']; $userfile_type = $_FILES['image']['type']; if (isset($_FILES['image']['name'])) { $uimg = $filedir.$userfile_name; $uimg_thumb = $thumbdir.$prefix.$userfile_name; move_uploaded_file($userfile_tmp, $uimg); chmod ($uimg, octdec($mode)); $sizes = getimagesize($uimg); $aspect_ratio = $sizes[0]/$sizes[0]; if ($sizes[0] <= $size) { $new_width = $sizes[0]; $new_height = $sizes[0]; }else{ $new_height = $size; $new_width = abs($new_height/$aspect_ratio); } $destimg=ImageCreateTrueColor($new_width,$new_height) or die('Problem In Creating image'); $srcimg=ImageCreateFromJPEG($uimg) or die('Problem In opening Source Image'); if(function_exists('imagecopyresampled')) { imagecopyresampled($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) or die('Problem In resizing'); }else{ Imagecopyresized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) or die('Problem In resizing'); } ImageJPEG($destimg,$uimg_thumb,90) or die('Problem In saving'); imagedestroy($destimg); } echo ' <a href="'.$uimg.'"> <img src="'.$uimg_thumb.'" width="'.$new_width.'" heigt="'.$new_height.'"> </a>'; } ?> </div> </body> </html> Works great, except when I upload a 400kb or larger file... Is there some kind of limit to the ability of the GD library? Anyone have a work around? Thanks!
  4. Hello all! I have a parser set up that I cannot grasp my head around why my loop does not work... Here is the code: <?php $insideitem = false; $tag = ""; $title = ""; $description = ""; $link = ""; $counter = 0; function startElement($parser, $name, $attrs) { global $insideitem, $tag, $title, $description, $link; if ($insideitem) { $tag = $name; } elseif ($name == "ITEM") { $insideitem = true; } } function endElement($parser, $name) { global $insideitem, $tag, $title, $description, $link; if ($name == "ITEM") { printf("<li><a href='%s'>%s</a></li>", trim($link),htmlspecialchars(trim($title))); printf("<dd>%s</dd>",htmlspecialchars(trim($description))); $title = ""; $description = ""; $link = ""; $insideitem = false; } } function characterData($parser, $data) { global $insideitem, $tag, $title, $description, $link; if ($insideitem) { switch ($tag) { case "TITLE": $title .= $data; break; case "LINK": $link .= $data; break; } } } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); $fp = fopen("http://www.fs.fed.us/r5/lassen/rss/rss.xml","r") or die("Error reading RSS data."); while($data = fread($fp, 80000) && $counter < 5) { xml_parse($xml_parser, $data, feof($fp)) or die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); $counter++; } fclose($fp); xml_parser_free($xml_parser); ?> I am trying to limit the amount of output from the RSS file to just 5 items, or records. I am trying to do this by using a while loop with a count in it when I am showing the feed items. I keep getting an error of: XML error: syntax error at line 1 I don't get it. Any help would be appreciated! Thanks!
  5. Hello I would like to connect to a db on another host I have set up, is this possible? and how so? Thanks
  6. Hello all, I need a hand getting a Form to submit XML data. I am not sure exactally how to get this to work. I would like to append to a current XML file whatever the user inputs.  I can't use DOM, it's not loaded on my server, and they won't load it on there... bahhH! Thanks
  7. I am not sure if I read this right, but you want to get the Loggedin persons ID and put it in another table? If so, check if user is logged in, select user ID, append info to new table. hope that helps.
  8. Is this overwriting anything in my txt file? list($csal_str, $psal_str) = file('firedata.txt'); or is it just parsing two vars out of it? thanks!
  9. Hi, I have never used that function. How do I get it to report the errors? I tried to print, does it just tell me how many? Thanks...
  10. You could make an ADMINPM.php page. Have the delete fuction in there along with your other functions.
  11. Hello all, I am glad that there is this community to help me sharpen my php skills. I have a form that I have created and will be posting data from to a text file. I don't have database access, so no database anything. It's all text files. I am getting better at using them... anyhow.. Here is my code. I can't figure out why it is not posting to the text file. [code]<!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=iso-8859-1" /> <title>FFDB</title> <style type="text/css"> <!-- .style1 {color: #FF0000} --> </style> </head> <body> <?php $now = time(); //current date $date = date("l, d F Y - h:i a",time() - 10800); //tomorrow $tomorrow = date("l, d F Y", mktime(0, 0, 0, date("m", $now)  , date("d", $now)+1, date("Y", $now))); //make sure all data is ready for post if(isset($_POST['Submit'])){   $cpal1 = $_POST['cpal1'];    $cpal2 = $_POST['cpal2'];   $cpal3 = $_POST['cpal3'];   $cpal4 = $_POST['cpal4'];   $cpal5 = $_POST['cpal5'];   $csal1 = $_POST['csal1'];   $csal2 = $_POST['csal2'];   $csal3 = $_POST['csal3'];   $csal4 = $_POST['csal4'];   $csal5 = $_POST['csal5'];   $ppal1 = $_POST['ppal1'];    $ppal2 = $_POST['ppal2'];   $ppal3 = $_POST['ppal3'];   $ppal4 = $_POST['ppal4'];   $ppal5 = $_POST['ppal5'];   $psal1 = $_POST['psal1'];   $psal2 = $_POST['psal2'];   $psal3 = $_POST['psal3'];   $psal4 = $_POST['psal4'];   $psal5 = $_POST['psal5'];     $err = '<span class="style1">Please Enter ALL Data</span><br>';     if(empty($csal1)){       $err;   }   if(empty($csal2)){       $err;   }   if(empty($csal3)){       $err;   }   if(empty($csal4)){       $err;   }   if(empty($csal5)){       $err;   }   if(empty($cpal1)){       $err;   }   if(empty($cpal2)){       $err;   }   if(empty($cpal3)){       $err;   }   if(empty($cpal4)){       $err;   }   if(empty($cpal5)){       $err;   }   if(empty($psal1)){       $err;   }   if(empty($psal2)){       $err;   }   if(empty($psal3)){       $err;   }   if(empty($psal4)){       $err;   }   if(empty($psal5)){       $err;   }   if(empty($ppal1)){       $err;   }   if(empty($ppal2)){       $err;   }   if(empty($ppal3)){       $err;   }   if(empty($ppal4)){       $err;   }   if(empty($ppal5)){       $err;   }   //if the form is all good, move on and get the positions in the file to be filled.   else{       $filename = 'firedata.txt';   $filetext = $csal1 . '#' . $csal2 . '#' . $csal3 . '#' . $csal4 . '#' . $csal5 . '#' . $cpal1 . '#' . $cpal2 . '#' . $cpal3 . '#' . $cpal4 . '#' . $cpal5 . '#' . $date . "\n" . $psal1 . '#' . $psal2 . '#' . $psal3 . '#' . $psal4 . '#' . $psal5 . '#' . $ppal1 . '#' . $ppal2 . '#' . $ppal3 . '#' . $ppal4 . '#' . $ppal5 . '#' . $tomorrow . "\n";             // Let's make sure the file exists and is writable first.       if (is_writable($filename)) {               // that's where $filetext will go when we fwrite() it.         if (!$handle = fopen($filename, 'w')) {             echo "Cannot open file ($filename)";             exit;         }               // Write $filetext to our opened file.         if (fwrite($handle, $filetext) === FALSE) {             echo "Cannot write to file ($filename)";             exit;         }                 echo "Success, wrote ($filetext) to file ($filename)";                 fclose($handle);             } else {         echo "The file $filename is not writable";       }   } } ?> <?php //read the file and store the contents in an array for display in current form if(file('firedata.txt', 'r')){ list($csal_str, $psal_str) = file('firedata.txt'); $acsal = explode('#', $csal_str); $apsal = explode('#', $psal_str); $cdate = array_pop($acsal); $pdate = array_pop($apsal); //error testing viewing text file 1st line print $acsal[0] . ' ' . $acsal[1] . ' ' . $acsal[2] . ' ' . $acsal[3] . ' ' . $acsal[4] . ' ' . $acsal[5] . ' ' . $acsal[6] . ' ' . $acsal[7] . ' ' . $acsal[8] . ' ' . $acsal[9] . ' ' . $cdate; //error testing viewing text file 2nd line print $apsal[0] . ' ' . $apsal[1] . ' ' . $apsal[2] . ' ' . $apsal[3] . ' ' . $apsal[4] . ' ' . $apsal[5] . ' ' . $apsal[6] . ' ' . $apsal[7] . ' ' . $apsal[8] . ' ' . $apsal[9] . ' ' . $pdate; }else { print "ERROR FILE NOT READABLE"; } ?> <form action="index.php" method="post" name="form1" id="form1">   <p>  </p>   <h4>Actual Activity Levels</h4>   </p>   <p>SAL - BOGARD:     <input name="csal1" type="text" id="csal1" value="<?php echo $acsal[0]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     SAL - CHESTER:     <input name="csal2" type="text" id="csal2" value="<?php echo $acsal[1]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     SAL - GORDON:     <input name="csal3" type="text" id="csal3" value="<?php echo $acsal[2]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     SAL - LADDER:     <input name="csal4" type="text" id="csal4" value="<?php echo $acsal[3]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     SAL - MANZANITA:     <input name="csal5" type="text" id="csal5" value="<?php echo $acsal[4]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     PAL - BOGARD:     <input name="cpal1" type="text" id="cpal1" value="<?php echo $acsal[5]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     PAL - CHESTER:     <input name="cpal2" type="text" id="cpal2" value="<?php echo $acsal[6]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     PAL - GORDON:     <input name="cpal3" type="text" id="cpal3" value="<?php echo $acsal[7]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     PAL - LADDER:     <input name="cpal4" type="text" id="cpal4" value="<?php echo $acsal[8]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     PAL - MANZANITA:     <input name="cpal5" type="text" id="cpal5" value="<?php echo $acsal[9]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />   </p>   <p>  </p>   <h4>Predicted Activity Levels</h4>   </p> <p>SAL - BOGARD:     <input name="csal1" type="text" id="csal1" value="<?php echo $apsal[1]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     SAL - CHESTER:     <input name="csal2" type="text" id="csal2" value="<?php echo $apsal[2]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     SAL - GORDON:     <input name="csal3" type="text" id="csal3" value="<?php echo $apsal[3]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     SAL - LADDER:     <input name="csal4" type="text" id="csal4" value="<?php echo $apsal[4]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     SAL - MANZANITA:     <input name="csal5" type="text" id="csal5" value="<?php echo $apsal[5]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     PAL - BOGARD:     <input name="cpal1" type="text" id="cpal1" value="<?php echo $apsal[6]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     PAL - CHESTER:     <input name="cpal2" type="text" id="cpal2" value="<?php echo $apsal[7]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     PAL - GORDON:     <input name="cpal3" type="text" id="cpal3" value="<?php echo $apsal[8]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     PAL - LADDER:     <input name="cpal4" type="text" id="cpal4" value="<?php echo $apsal[9]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br />     PAL - MANZANITA:     <input name="cpal5" type="text" id="cpal5" value="<?php echo $apsal[10]; ?>" size="6" style="text-transform: uppercase;" maxlength="6" />     <br /> </p>   <p>     <input type="submit" name="Submit" value="Submit" />   </p> </form> </body> </html> [/code] Thanks!
×
×
  • 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.