Jump to content

piznac

Members
  • Posts

    261
  • Joined

  • Last visited

Everything posted by piznac

  1. Wow,.. that seems to have fixed the problem,... [code]require_once('/home/rack/public_html/project/Connections/pms.php'); //get job number $job = $_POST['num']; //get directory $direc = $_POST['nam']; //change spaces to _ for dir $dir1=trim($direc); $dir2=str_replace(' ', '_', $dir1); //set base path for database $basepath="http://project.rackattackzone.com/jobs/$dir2/return_images/"; $thumbpath="http://project.rackattackzone.com/jobs/$dir2/return_images/thumbs/"; foreach ($_FILES['file']['name'] as $k => $filename) {         if ($filename != '')  {                     $tmpfile = $_FILES['file']['tmp_name'][$k]; }   //change spaces to %20 $filenames=trim($filename); $filenamea=str_replace(' ', '%20', $filenames);    //if the temp file1 is there copy it to the server if (@is_uploaded_file($tmpfile) && $filenamea != '') { copy($tmpfile, "/home/rack/public_html/project/jobs/$dir2/return_images/" .$filename); } //get image size and name if ($filename != ''){ $im_file_name =  "/home/rack/public_html/project/jobs/$dir2/return_images/" . $filename; $image_attribs = getimagesize($im_file_name); $im_old = imageCreateFromJpeg($im_file_name); //declare thumb $th_max_width = 100; $th_max_height = 100; $ratio = ($width > $height) ? $th_max_width/$image_attribs[0] : $th_max_height/$image_attribs[1]; $th_width = $image_attribs[0] * $ratio; $th_height = $image_attribs[1] * $ratio; $im_new = imagecreatetruecolor($th_width,$th_height); imageAntiAlias($im_new,true); //resize image $th_file_name = "/home/rack/public_html/project/jobs/$dir2/return_images/thumbs/" . $filename; imageCopyResampled($im_new,$im_old,0,0,0,0,$th_width,$th_height, $image_attribs[0], $image_attribs[1]); imageJpeg($im_new,$th_file_name,100); //get array of filenames $pathname = $basepath . $filenamea; $thumbpath2 = $thumbpath . $filenamea; if ($filenamea != ''){ $mysql = "rack_pm"; mysql_select_db($mysql); $sql = "INSERT INTO `returnedfiles` (`imagepath`, `thumbpath`, `jobnum`, `pname`, `num`, `autojobnum`) VALUES ('$pathname', '$thumbpath2', '$job', '$direc', NULL, '1');"; mysql_query($sql) or die(mysql_error()); } } } ?> [/code] Thanks man
  2. ok I'll give that a shot
  3. Ok got a strange one here: [code]require_once('/home/rack/public_html/project/Connections/pms.php'); //get job number $job = $_POST['num']; //get directory $direc = $_POST['nam']; //change spaces to _ for dir $dir1=trim($direc); $dir2=str_replace(' ', '_', $dir1); //set base path for database $basepath="http://project.rackattackzone.com/jobs/$dir2/return_images/"; $thumbpath="http://project.rackattackzone.com/jobs/$dir2/return_images/thumbs/"; //get array of filenames foreach($_FILES['file']['name'] as $value1) { $filename .= "$value1"; //change spaces to %20 $filenames=trim($filename); $filenamea=str_replace(' ', '%20', $filename); } foreach ($_FILES['file']['name'] as $k => $filenamea) {         if ($filenamea != '')  {                     $tmpfile = $_FILES['file']['tmp_name'][$k]; }     //if the temp file1 is there copy it to the server if (@is_uploaded_file($tmpfile) && $filenamea != '') { copy($tmpfile, "/home/rack/public_html/project/jobs/$dir2/return_images/" .$filename); } //get image size and name if ($filename != ''){ $im_file_name =  "/home/rack/public_html/project/jobs/$dir2/return_images/" . $filename; $image_attribs = getimagesize($im_file_name); $im_old = imageCreateFromJpeg($im_file_name); //declare thumb $th_max_width = 100; $th_max_height = 100; $ratio = ($width > $height) ? $th_max_width/$image_attribs[0] : $th_max_height/$image_attribs[1]; $th_width = $image_attribs[0] * $ratio; $th_height = $image_attribs[1] * $ratio; $im_new = imagecreatetruecolor($th_width,$th_height); imageAntiAlias($im_new,true); //resize image $th_file_name = "/home/rack/public_html/project/jobs/$dir2/return_images/thumbs/" . $filename; imageCopyResampled($im_new,$im_old,0,0,0,0,$th_width,$th_height, $image_attribs[0], $image_attribs[1]); imageJpeg($im_new,$th_file_name,100); //get array of filenames $pathname = $basepath . $filenamea; $thumbpath2 = $thumbpath . $filenamea; if ($filenamea != ''){ $mysql = "rack_pm"; mysql_select_db($mysql); $sql = "INSERT INTO `returnedfiles` (`imagepath`, `thumbpath`, `jobnum`, `pname`, `num`, `autojobnum`) VALUES ('$pathname', '$thumbpath2', '$job', '$direc', NULL, '1');"; mysql_query($sql) or die(mysql_error()); } } } ?> [/code] If one file is uploaded this works great. But if I upload multiple files,.. well its wierd it names 1 file with all the names of the other files. It only thumbnails one and the insert into database seems to work fine. So where did I go wrong? Also is thier a faster way of doing this? This is on a windows mobile enabled smart phone so speed is very important....thanks!
  4. piznac

    OR problem

    AH HA,... knew it had to be something simple. Thanks much!
  5. piznac

    OR problem

    hey guys, Im having a problem that should be easy: [code]SELECT * FROM subjob WHERE pname = 'PHP Get Parameter'  AND subjob.markcomplate != 'Y' OR  subjob.markcomplate IS NULL [/code] well I need this to give me the results filtered by the project name (pname) then filter it again by "markcomplete" not equaling 'Y'. But it would seem if that field is NULL then it won't return it. Strange but oh well,.. so I put in the OR statement and of course now its ignoring the first statement as long as that field is NULL,.. How would I do this correctly?
  6. Ok I will have to try that,.. and what is sth?
  7. ok,.. do you know if I could replace something in the string to make it work or something?
  8. Is it possible to have this: [quote]<?php $i = "123"; ?> //get recordset from DB where this is part of it: recordset results = <table width="188" border="0" cellspacing="0" cellpadding="0">   <tr>     <td><?php echo $i ?></td>   </tr>   <tr>     <td>&nbsp;</td>   </tr> </table>[/quote] This may be a little hard to understand. But inside my database I have some HTML,.. with some PHP statements inside. They are not working at all. Anybody have any insight?
  9. ahhh it would appear the variable was misspelled,. thanks for the help man!!:)
  10. hmm,.. Im getting no results returned with this :-\
  11. Ok,.. I would have thought this would have been simple,.. but I can't seem to pull it off. I have a list of email addys store in a table and I need to pull those results. Then place them as a comma seperated string in a variable. Here is what I have so far: [code]<?php mysql_select_db($database_pms, $pms); $query = sprintf("SELECT email FROM access"); $em = mysql_query($query) or die(mysql_error()); $array = array($em); $comma_separated = implode(",", $array); echo $comma_separated; ?>[/code] this is simply returning: Resource id #4 I had it set up like this: [code]<?php mysql_select_db($database_pms, $pms); $query = sprintf("SELECT email FROM access"); $em = mysql_query($query) or die(mysql_error()); while ($array= mysql_fetch_assoc($em)) {         $try2 = "$array[email]\n"; $try3 = explode(" ",$try2); echo $try3[0]; $fnamec=str_replace(' ', ',', $try3[0]); echo $fnamec; } ?>[/code] I can get it to display the array,.. but not comma seperated and not where I can use it
  12. well if you ever get the chance,... run the other way!! ;D
  13. Ok I now have another problem,... this dosent work on windows mobile 5,.. anyone of you guys have any experience with this OS? Or the smart phone tech?
  14. Once again Barand you have been a tremendous help,. that worked beautifully. Anyway i can return the favor?
  15. Ok,... wow I really must learn some Html/Java skills  :) I finally have it out putting correctly [code]$img = 11 38 11 38 11 38 11 37 11 37 11 36 11 36 13 35 13 35 15 33 15 33 20 32 20 32 24 29 24 29 28 27 28 27 35 25 35 25 38 24 38 24 41 23 41 23 45 23 45 23 46 23 46 23 49 23 49 23 50 24 50 24 51 26 51 26 51 28 51 28 51 32 51 32 50 34 50 34 49 34 49 34 49 33 49 33 49 32 49 32 50 30 50 30 52 28 52 28 55 26 55 26 60 23 60 23 66 20 66 20 71 18 71 18 73 16 73 16 74 16 74 16 75 17 75 17 76 19 76 19 77 19 77 19 78 19 78 19 80 18 80 18 86 17 86 17 95 17 95 17 103 17 103 17 114 17 114 17 118 17 118 17 121 17 121 17 122 17 122 17 123 17 123 17 125 17 125 17 127 16 127 16 129 15 129 15 131 15 131 15 134 15 134 15 136 15 136 15 137 17 137 17 139 18 139 18 140 20 140 20 141 20 141 20 141 19 141 19 141 18 141 18 143 14 143 14 145 12 145 12 147 10 147 10 150 8 150 8 152 7 152 7 154 7 154 7 155 7 155 7 157 7 157 7 158 7[/code] Now Im getting a cannot modify headers error...I place the code at the very top of my page in hopes that I would have a real simple way out,.. but no such luck. Here is the code thus far: [code]//get signature image $img = $_POST['signature']; if ($img == ''){ echo "no worky"; }else{ echo "$img"; }   $im = imagecreate(200,50);   $white = imagecolorallocate($im, 0xff, 0xff, 0xff);   $red = imagecolorallocate($im, 0xff, 0x00, 0x00);     $data = "$img";     $points = explode(' ', $data);  // put data into an array   $num = count($points)/2;   imagepolygon($im, $points, $num, $red);     header ("content-type: image/png");   imagepng ($im);   imagedestroy($im);[/code] and the error: [code]Warning: Cannot modify header information - headers already sent by (output started at /home/rack/public_html/project/mobile/signoff_results.php:7) in /home/rack/public_html/project/mobile/signoff_results.php on line 21 ‰PNG  IHDRÈ2#Ÿ¢PLTEÿÿÿÿëZç“ÎIDAT8í’= Â@…ß1 ÁD±&G°°H!AÄx`i‘bñi’#¤´ã®é6o[ñUÃ~̾ù~Dê)‘ ‘Èêû”*@¬wi 9È ûº½öOoûû¹e­Õ‡Þ?“¸Û`ã“hêì]à“³³gDi`KË¡!ï­wö¾BäkÄ쫉QløÁ %KIµw[^hÅÚv¯lŸ|÷C <RRØâ(QU·6_{.œD‚=ˆ×:¯%’Jà¯zß%†Í´@XIEND®B`‚[/code] thanks for all the help man,.. it means alot. Also I would like to out put to a jpg,.. I will be reading the manual to tried to figure this one out,.. thanks
  16. Ok,.. I'm starting to get the impression that Im not getting the data needed from the applet. You said you are not familar with this applet?
  17. Ok,.. so if they are not being outputted that way,.. then that would be the problem yes? I will have to dig a little deeper,.. TY
  18. If this helps,.. this is an excerpt from the perl/CGI script that is supposed to email this: [code]# Create the image. $im = new GD::Image($width,$height) || die 'image error'; # allocate white $white = $im->colorAllocate(255, 255, 255); # allocate black $black = $im->colorAllocate(0, 0, 0); # Get the points. $_=param('signature'); if($_==undef){ print ("Content-type: text/html\n\n"); print 'Nothing is drawn.'; die 'no drawing'; } # Set binary mode. binmode STDOUT; # Make a temp image on disk. # Get the date: $filetimestamp=`$DATE '+%H:%M:%S'`; chomp($filetimestamp); $tempimage="/tmp/tempimage.$filetimestamp.$$"; open (image, ">$tempimage"); print image $im->jpeg(); close image;[/code]
  19. Ok I am so confused..lol But I feel I am getting closer so please bear with me. I tried this [code]//get signature image $img = $_POST['signature']; //Create the Image 200X 50Y $im = imagecreate(200, 50); // white background and blue text $bg = imagecolorallocate($im, 0, 0, 0); $textcolor = imagecolorallocate($im, 255, 255, 255); $string = "$img"; // write the string at the top left imagestring($im, 5, 5, 5, $string, $textcolor); // output the image header("Content-type: image/png"); imagepng($im);[/code] This outputs a black image,.. so I tried what you suggested Barand: [code]//get signature image $img = $_POST['signature'];   $im = imagecreate(200,50);   $white = imagecolorallocate($im, 0xff, 0xff, 0xff);   $red = imagecolorallocate($im, 0xff, 0x00, 0x00);     $points = array($img);   imagepolygon($im, $points, 4, $red);     header ("content-type: image/png");   imagepng ($im);   imagedestroy($im);[/code] I get this error: [code]Warning: imagepolygon() [function.imagepolygon]: You must have at least 3 points in your array in /home/rack/public_html/project/mobile/signoff_results.php on line 177 Warning: Cannot modify header information - headers already sent by (output started at /home/rack/public_html/project/mobile/signoff_results.php:177) in /home/rack/public_html/project/mobile/signoff_results.php on line 179 ‰PNG  IHDRÈ2#Ÿ¢PLTEÿÿÿÿëZç“IDAT8c`£`Œ‚Q•¡ÈIEND®B`‚[/code] Now I am right in assuming that I must make $img an array? And if so how?... If not any Ideas?
  20. yeah I really dont get that,.. hmmm, could you possibly give me an example? ::) I think the string will be stored here: [code]$img = $_POST['signature'];[/code]
  21. Well,.. guys Im lost so I willtry anything at this point,... how would I use imagecreatefromstring(); onlyican? These sre supposed to be the params I go by: [code] <INPUT TYPE=hidden NAME="signature" value=""> <INPUT TYPE=hidden NAME="width" value="200"> <INPUT TYPE=hidden NAME="height" value="50"> <INPUT TYPE=hidden NAME="filename" value="testsig.jpg"> <input type="submit" name="Submit" value="Submit" />[/code] Well now I end up with a blank image,.. which is closer ;D
  22. to be honest with you Barand,.. I havent gotten them to display yet (the actual string that is). But an example would be: 10 10 100 10 100 10 100 100 100 100 10 100 10 100 10 10  this would display a box onlyican I will give that a shot,..
×
×
  • 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.