Jump to content

techker

Members
  • Posts

    812
  • Joined

  • Last visited

Everything posted by techker

  1. techker

    if submit

    hey guys im trying to make this form i want it to insert in database on submit.. i got if($_POST["submit"] == "Insert"){ $img=$_POST['img']; mysql_query("UPDATE `_users` SET `logo` = '$img' WHERE `userid` = 2"); echo "<meta http-equiv=Refresh content=2;url=main.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>Untitled Document</title> </head> <body> <form action="#" method="post" enctype="multipart/form-data" > <p> <label> <input name="img" type="file" id="img" size="15" /> </label> </p> <p> <label> <input type="submit" name="Insert" value="submit" width="5"/> </label> </p> </form> it does not work?
  2. it uploads the file and creats a thumbnail. it keeps the size of the original and uploads it to images/big and resizes it and uploads the resized image to images/thumbs Now.i want to make the Big images a diffrent size.
  3. Hey guys i have an uploader and resizer script that works a1.the only thing is i would like to resize the original image. see now it resizes for a thumbnail and uplloads it to the image/thumb and the original to image/big //load the config file include("config.php"); //if the for has submittedd if (isset($_POST['upForm'])){ $file_type = $_FILES['imgfile']['type']; $file_name = $_FILES['imgfile']['name']; $file_size = $_FILES['imgfile']['size']; $file_tmp = $_FILES['imgfile']['tmp_name']; $Box = $_POST['Box']; $ID = $_GET['ID']; //check if you have selected a file. if(!is_uploaded_file($file_tmp)){ echo "Error: Please select a file to upload!. <br>--<a href=\"$_SERVER[php_SELF]\">back</a>"; exit(); //exit the script and don't do anything else. } //check file extension $ext = strrchr($file_name,'.'); $ext = strtolower($ext); if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { echo "Wrong file extension. <br>--<a href=\"$_SERVER[php_SELF]\">back</a>"; exit(); } //get the file extension. $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; //create a random file name $rand_name = md5(time()); $rand_name= rand(0,999999999); //get the new width variable. $ThumbWidth = $img_thumb_width; //keep image type if($file_size){ if($file_type == "image/pjpeg" || $file_type == "image/jpeg"){ $new_img = imagecreatefromjpeg($file_tmp); }elseif($file_type == "image/x-png" || $file_type == "image/png"){ $new_img = imagecreatefrompng($file_tmp); }elseif($file_type == "image/gif"){ $new_img = imagecreatefromgif($file_tmp); } //list width and height and keep height ratio. list($width, $height) = getimagesize($file_tmp); $imgratio=$width/$height; if ($imgratio>1){ $newwidth = $ThumbWidth; $newheight = $ThumbWidth/$imgratio; }else{ $newheight = $ThumbWidth; $newwidth = $ThumbWidth*$imgratio; } //function for resize image. if (function_exists(imagecreatetruecolor)){ $resized_img = imagecreatetruecolor($newwidth,$newheight); }else{ die("Error: Please make sure you have GD library ver 2+"); } imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); //save image ImageJpeg ($resized_img,"$path_thumbs/$rand_name.$file_ext"); ImageDestroy ($resized_img); ImageDestroy ($new_img); //print message // echo "<br>Image Thumb: <a href=\"$path_thumbs/$rand_name.$file_ext\">$path_thumbs/$rand_name.$file_ext</a>"; } //upload the big image move_uploaded_file ($file_tmp, "$path_big/$rand_name.$file_ext"); echo "<meta http-equiv=Refresh content=1;url=insert.php?ID=$ID&Name=$rand_name.$file_ext>"; } ///////////////////////////insert part added echo" </body> </html>"; ?> Is it possible?
  4. the thumbnailing does not work? and on this line $thumb_width = 10; there was a - infront of = is this normal?
  5. nice thx!! its all good but the thumbs dont work? <?php function resize($img, $thumb_width, $newfilename) { $max_width=$thumb_width; //Check if GD extension is loaded if (!extension_loaded('gd') && !extension_loaded('gd2')) { trigger_error("GD is not loaded", E_USER_WARNING); return false; } //Get Image size info list($width_orig, $height_orig, $image_type) = getimagesize($img); switch ($image_type) { case 1:$im = imagecreatefromgif($img);break; case 2: $im = imagecreatefromjpeg($img); break; case 3:$im = imagecreatefrompng($img); break; default: trigger_error('Unsupported filetype!', E_USER_WARNING); break; } /*** calculate the aspect ratio ***/ $aspect_ratio = (float) $height_orig / $width_orig; /*** calculate the thumbnail width based on the height ***/ $thumb_height = round($thumb_width * $aspect_ratio); while($thumb_height>$max_width) { $thumb_width-=10; $thumb_height = round($thumb_width * $aspect_ratio); } $newImg = imagecreatetruecolor($thumb_width, $thumb_height); /* Check if this image is PNG or GIF, then set if Transparent*/ if(($image_type == 1) OR ($image_type==3)) { imagealphablending($newImg, false); imagesavealpha($newImg,true); $transparent = imagecolorallocatealpha($newImg, 255, 255, 255, 127); imagefilledrectangle($newImg, 0, 0, $thumb_width, $thumb_height, $transparent); } imagecopyresampled($newImg, $im, 0, 0, 0, 0, $thumb_width, $thumb_height, $width_orig, $height_orig); //Generate the file, and rename it to $newfilename switch ($image_type) { case 1: imagegif($newImg,$newfilename); break; case 2: imagejpeg($newImg,$newfilename); break; case 3: imagepng($newImg,$newfilename); break; default: trigger_error('Failed resize image!', E_USER_WARNING); break; } return $newfilename; } //This stuff is outside of the function. It operates with our images if(isset($_POST[submit])){ $imgNumb=1; //This the "pointer" to images $DestinationDir="upimg/"; //Place the destination dir here $ThumbDir="upimg/thumbs"; //Place the thumb dir here do{ $Unique=microtime(); // We want unique names, right? $destination=$DestinationDir.md5($Unique).".jpg"; $thumb=$ThumbDir.md5($Unique).".jpg"; $IMG=getimagesize($_FILES["img$imgNumb"][tmp_name]); echo resize($_FILES["img$imgNumb"][tmp_name], $IMG[0], $destination); $imgNumb++; } while($_FILES["img$imgNumb"][name]); }?> <!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>Untitled Document</title> </head> <body> <form action="" method="post" enctype="multipart/form-data" > <input type="file" name="img1"/> <input type="file" name="img2"/> <input type="file" name="img3"/> <input type="submit" name="submit" value="Submit"/> </form> </body> </html>
  6. nice it uploads but it dows not resize?
  7. is this hard?or is it my post?lol
  8. Hey guys i have this image uploader and resize script..it currently only uploads one image..i would like to mod it to upload 3 images.. here is the original code and below it is what i think to change <!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <title></title> <?php //load the config file include("config.php"); //if the for has submittedd if (isset($_POST['upForm'])){ $file_type = $_FILES['imgfile']['type']; $file_name = $_FILES['imgfile']['name']; $file_size = $_FILES['imgfile']['size']; $file_tmp = $_FILES['imgfile']['tmp_name']; $Box = $_POST['Box']; $CAR_ID = $_GET['ID']; //check if you have selected a file. if(!is_uploaded_file($file_tmp)){ echo "Error: Please select a file to upload!. <br>--<a href=\"$_SERVER[php_SELF]\">back</a>"; exit(); //exit the script and don't do anything else. } //check file extension $ext = strrchr($file_name,'.'); $ext = strtolower($ext); if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { echo "Wrong file extension. <br>--<a href=\"$_SERVER[php_SELF]\">back</a>"; exit(); } //get the file extension. $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; //create a random file name $rand_name = md5(time()); $rand_name= rand(0,999999999); //get the new width variable. $ThumbWidth = $img_thumb_width; //keep image type if($file_size){ if($file_type == "image/pjpeg" || $file_type == "image/jpeg"){ $new_img = imagecreatefromjpeg($file_tmp); }elseif($file_type == "image/x-png" || $file_type == "image/png"){ $new_img = imagecreatefrompng($file_tmp); }elseif($file_type == "image/gif"){ $new_img = imagecreatefromgif($file_tmp); } //list width and height and keep height ratio. list($width, $height) = getimagesize($file_tmp); $imgratio=$width/$height; if ($imgratio>1){ $newwidth = $ThumbWidth; $newheight = $ThumbWidth/$imgratio; }else{ $newheight = $ThumbWidth; $newwidth = $ThumbWidth*$imgratio; } //function for resize image. if (function_exists(imagecreatetruecolor)){ $resized_img = imagecreatetruecolor($newwidth,$newheight); }else{ die("Error: Please make sure you have GD library ver 2+"); } imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); //save image ImageJpeg ($resized_img,"$path_thumbs/$rand_name.$file_ext"); ImageDestroy ($resized_img); ImageDestroy ($new_img); //print message echo "<br>Image Thumb: <a href=\"$path_thumbs/$rand_name.$file_ext\">$path_thumbs/$rand_name.$file_ext</a>"; } //upload the big image move_uploaded_file ($file_tmp, "$path_big/$rand_name.$file_ext"); echo "<br>Image Big: <a href=\"$path_big/$rand_name.$file_ext\">$path_big/$rand_name.$file_ext</a>"; echo "<br><br>--<a href=\"$_SERVER[php_SELF]\">back</a>"; } ///////////////////////////insert part added mysql_connect("localhost", "techker_techker", "techker") or die(mysql_error()) ; mysql_select_db("techker_iapps") or die(mysql_error()) ; $DateHeure= date("Y-m-d H:i:s"); $query = "INSERT INTO AddOnImages ( CAR_ID, Box , Name, date ) VALUES ( NULL,'$CAR_ID','$Box','$rand_name.$file_ext','$DateHeure')" ; mysql_query($query) or die('Error, add album failed : ' . mysql_error()); //$id= mysql_insert_id(); //echo "<p>This file has the following Database ID: <b>$id</b>"; echo "You'll be redirected to Home Page after (4) Seconds"; echo "<meta http-equiv=Refresh content=4;url=ViewPost.php?ID=>"; // echo" </body> </html>"; ?> SO for shure in the form i need to add 2 more image file fields.called the imagefile2,imagefile3.since the first one is called imagefile. them im almost shure i need to add this $file_type3 = $_FILES['imgfile2']['type']; $file_name2 = $_FILES['imgfile2']['name']; $file_size2 = $_FILES['imgfile2']['size']; $file_tmp2 = $_FILES['imgfile2']['tmp_name']; $file_type 3= $_FILES['imgfile3']['type']; $file_name 3= $_FILES['imgfile3']['name']; $file_size 3= $_FILES['imgfile3']['size']; $file_tmp3 = $_FILES['imgfile3']['tmp_name']; To get the other images. Afther: $ext = strrchr($file_name,'.'); to $ext = strrchr($file_name,$file_name2,$file_name3,'.'); and $getExt = explode ('.', $file_name); to $getExt = explode ('.', $file_name,$file_name2,$file_name3); Afther im lost...is this good up to know?
  9. all im trying to do is echo money format...
  10. hey guys im trying to echo a money format.. $query3 = "SELECT * FROM `tblCommande` WHERE NoCommande ='$order' " ; $result3 = mysql_query($query3) or die(mysql_error()); while ($row8 = mysql_fetch_array($result3)) { $array['assigned'] = $row8['SousTotal']); } print"$array"
  11. does it matter?cause it works?
  12. ok so i got this going $order=$_GET['order']; $date=$_GET['Date']; $query = "select * from tblCommande right join tblCommandeDetail on tblCommande.NoCommande = $order AND $date " ; $result = mysql_query($query) or die(mysql_error()); <? while($row = mysql_fetch_array($result)){ echo $row['UName']. " - ". $row['IDProduit']; echo "<br />"; }?> works good but not completly..i dont have all the information?
  13. Hey guys i have a litle question.. i have a catalogue database with a order-order details and products tables. now when an order is passt it goes true an xml flash page.. but i need to mode it so i want to drop the flash and only use php. so in the databse in the order table there is orderID and user info.then in orderDetails theres the orderID and a product id so what i did up to know is extract all orders so i get orderID name price.. but know i need details so i linked it to a OrderDetails page that gives me OrderId ProductId QTY.. so thats cool but know i need to get the product details from Product Table.. so Product id gives me a descrition of the products... ahhh is there a way to make it one?lol! or at least to see the order page but when you click more details or print you get the product descritption... thx guys!!
  14. i reuploaded the script and it works now..my vps is acting up!thx
  15. what does this meen? Notice: Undefined index: 2 in /home/open2sha/public_html/new/includes/core/core.session.php on line 0 Notice: Undefined index: 2 in /home/open2sha/public_html/new/includes/core/core.session.php on line 0 Notice: Undefined offset: 2 in /home/open2sha/public_html/new/includes/core/core.session.php on line 0 Warning: Invalid argument supplied for foreach() in /home/open2sha/public_html/new/includes/core/core.session.php on line 0 MySQL ERROR
  16. ah so its the query.not a syntax. it is seing the member since the name is there(techker) thx
  17. Hey guys i activated a addon for a cms and i get this? Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/open2sha/public_html/new/prochatrooms/cms.php on line 18 Duplicate entry 'techker' for key 1 i checked in the database and it is only there one time?no duplicate?
  18. Hey guys i have this : <?php if ( $this->objval($_obj,'group_label') != "general") { ?> <div class="datainfo profile" id="profile_data_<?php echo isset($_obj['rowcnt']) ? $_obj['rowcnt'] : "&#123;rowcnt&#125;"; ?>_content" style="display: none"> <dl class="datainfo"> <?php if (!empty($_obj['profile_fields'])){ if (!is_array($_obj['profile_fields'])) $_obj['profile_fields']=array(array('profile_fields'=>$_obj['profile_fields'])); $_tmp_arr_keys=array_keys($_obj['profile_fields']); if ($_tmp_arr_keys[0]!='0') $_obj['profile_fields']=array(0=>$_obj['profile_fields']); $_stack[$_stack_cnt++]=$_obj; $_cnt['profile_fields']=count($_obj['profile_fields']); foreach ($_obj['profile_fields'] as $rowcnt=>$profile_fields) { $profile_fields['rowcnt']=$rowcnt; $profile_fields['rowpos']=$rowcnt+1; $profile_fields['rownum']=$rowcnt%2+1; $profile_fields['rowtotal']=$_cnt['profile_fields']; $profile_fields['rowfirst']=$rowcnt==0?1:0; $profile_fields['rowlast']=($rowcnt+1)==$_cnt['profile_fields']?1:0; $_obj=&$profile_fields; ?> <dt><?php echo isset($_obj['field_name']) ? $_obj['field_name'] : "&#123;field_name&#125;"; ?>:</dt> <dd> <?php if ( $this->objval($_obj,'field_value') ) { ?> <?php if ( $this->objval($_obj,'field_type') == "checkbox") { ?> <?php echo vldext_break($_obj['field_value']); ?> <?php } else { ?> <?php echo isset($_obj['field_value']) ? $_obj['field_value'] : "&#123;field_value&#125;"; ?> <?php } ?> <?php } else { ?> {lang:"core","user_ Parse error: syntax error, unexpected $end in /home/open2sha/public_html/new/templates/sexypeople/tmp/account_home_tpl.php on line 167 is it because im missing ;
  19. techker

    cursor help

    hey guys i made a scan page and was wondering how to make it that when the page reloads after scan the cursor comes back in the scan box? cause now we need to put the mouse back every time..
  20. ah...cool thanks for the help!! all godd thx! <?php echo ($row['status']=="active") ? "<img src=icons/actif.jpg />" : "<img src=icons/inactif.jpg />"; ?>
  21. ah...cool thx for the help!!
  22. hey guys i have a databse set and in it there is a filed called status. in it active or not active i would like to echo if not_active show image/... if active show other image.. can somebody hel me with this? i only cold get this going.. echo (empty($row['status'])? "empty": "not empty"); //result not empty
  23. techker

    tax..

    lol.thx akitchin will do and Maq its alot ah!it was more but they droped it..
  24. techker

    tax..

    canada quebec tax 13.5
×
×
  • 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.