Jump to content

jacque99

Members
  • Posts

    14
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

jacque99's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello everyone, I use google API geocoder to find places here in Canada In my research, I do not always get the same results BY example if I seek the city that London is in Canada, I receive Londopn of UK Here is an example of the API I speak: http://gmaps-samples.googlecode.com/svn/trunk/geocoder/singlegeocode.html I wonder if there is a method to specify the country thank you
  2. Control problem based on two forms Hello everyone, I have a problem with the control of my two forms principle it is good for the first form, but if I wanted to control my 2nd form, blocking ca Here's the script: <html> <head> <script type="text/javascript" > function formValidation1(oEvent) { oEvent = oEvent || window.event; var txtField = oEvent.target || oEvent.srcElement; var txt_nom_pereck1=true; var msg=" "; if(document.getElementById("txt_nom_pere").value.length < 3 ){ txt_nom_pereck1=false; msg = msg + "Your name should be minimun 3 char length";} if(document.getElementById("txt_prenom_pere").value.length < 3 ){ txt_nom_pereck1=false; msg = msg + "Your name should be minimun 3 char length";} if(txt_nom_pereck1){document.getElementById("submit_etape4").style.display='block'; } else{document.getElementById("submit_etape4").style.display='none'; } } window.onload = function () { var submit_etape4 = document.getElementById("submit_etape4"); var txt_nom_pere = document.getElementById("txt_nom_pere"); var txt_prenom_pere = document.getElementById("txt_prenom_pere"); var txt_courriel_pere = document.getElementById("txt_courriel_pere"); var txt_courriel_pere_conf = document.getElementById("txt_courriel_pere_conf"); var txt_nom_pereck1=false; document.getElementById("submit_etape4").style.display='none'; txt_nom_pere.onkeyup = formValidation1; txt_prenom_pere.onkeyup = formValidation1; } //************Partie 2 : ******///////////////////////////// /* function formValidation2(oEvent) { oEvent = oEvent || window.event; var txtField = oEvent.target || oEvent.srcElement; var txt_nom_pereck2=true; var msg=" "; if(document.getElementById("txt_courriel_pere").value.length < 3 ){ txt_nom_pereck2=false; msg = msg + "Your name should be minimun 3 char length";} if(document.getElementById("txt_courriel_pere_conf").value.length < 3 ){ txt_nom_pereck2=false; msg = msg + "Your name should be minimun 3 char length";} if(txt_nom_pereck2){document.getElementById("submit_etape5").style.display='block'; } else{document.getElementById("submit_etape5").style.display='none'; } } window.onload = function () { var submit_etape5 = document.getElementById("submit_etape5"); var txt_courriel_pere = document.getElementById("txt_courriel_pere"); var txt_courriel_pere_conf = document.getElementById("txt_courriel_pere_conf"); var txt_nom_pereck2=false; document.getElementById("submit_etape5").style.display='none'; txt_nom_pere.onkeyup = formValidation2; txt_prenom_pere.onkeyup = formValidation2; } Je voulais activer cette partie pour comtrole le Form 2 Le probleme existe au niveau des nom des fonctions I wanted this part to enable the Comtrol Form 2 The problem exists at the level of function names */ </script> </head> <body > <form method=" post" action="form-success.php"> <table> <tr> <td>First Name</td> <td><input type="text" id="txt_nom_pere" name="FirstName"></td> </tr> <tr> <td>First Name</td> <td><input type="text" id="txt_prenom_pere" name="FirstName"></td> </tr> </table> <input type="button" id="submit_etape4" value="Sign Up!!" style="display:none;" /> </form> <form method=" post" action="form-success.php"> <table> <tr> <td>First Name</td> <td><input type="text" id="txt_courriel_pere" name="FirstName"></td> </tr> <tr> <td>First Name</td> <td><input type="text" id="txt_courriel_pere_conf" name="FirstName"></td> </tr> </table> <input type="button" id="submit_etape5" value="Sign Up!!" style="display:none;" /> </form> </body> </html>
  3. Hello everyone, I have a small problem with the JavaScript event if I filled the box name, and I chose an option "Fellow" and then choose the sex appears Botton me what I want to do is to tick both radios Botton, and when I start typing the name, the button will appear next Here's the script: [attachment deleted by admin]
  4. Hello everyone, I have a small problem in my php script In my select I have two types of request, "Show all" that displays all the marks and the other as a parameter query that takes the brand chosen. When I chose to deal with brand it works, and when I selected after dealing with "Show all" It works. What I wanted to make is that the first time, "show all" market will be Here's the script: [attachment deleted by admin]
  5. I tried on several places but it does not work
  6. Hello everyone, I have a problem in the session start in my cart I always get the following error: Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition panier of the object you are trying to operate on was loaded _before_ the session was started Here is the script : <?php $date_echeance = date("d-m-Y", strtotime("+ 1 MONTHS")); $d = date("d-m-Y"); echo "<html>"; echo "<head> "; echo "<title>HTML2PDF - Examples - en</title> "; echo "</head>"; echo "</html>"; session_start(); include_once '/../../../panier.class.php'; $contenu = ""; $page = null; /************************************************************************************************* ** affectations variables ** *************************************************************************************************/ $page->maj = isset($_POST["maj_x"]) ? $_POST["maj_x"] : ""; $page->base = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https" : "http")."://".$_SERVER["HTTP_HOST"]; $page->dirname = dirname($_SERVER["SCRIPT_NAME"]); $page->query = isset($_SERVER["QUERY_STRING"]) ? "?".$_SERVER["QUERY_STRING"]."" : ""; $page->protocol = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https" : "http"; $page->action = $page->protocol."://".$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"].$page->query; $page->panier = isset($_SESSION['panier']) ? unserialize($_SESSION['panier']) : ""; /************************************************************************************************* ** programme principal ** *************************************************************************************************/ print ' <html> <head> <title>Consultation Panier</title> </head> <body> <form name="form1" method="post" action="'.$page->action.'" enctype="application/x-www-form-urlencoded">'; if ($page->maj) maj($page); $contenu .= Affichages($page); print $contenu.' </form> </body> </html>'; $_SESSION["panier"] = serialize($page->panier); /************************************************************************************************* ** fonctions ** *************************************************************************************************/ //Créer les variables de session pour le num du facture et le nom du client $num_fatcure=$_POST['num_fatcure']; $nom_client=$_POST['nom_client']; $observation=$_POST['observation']; echo $observation; //echo $_SESSION['num_fatcure'] ; $_SESSION['num_fatcure'] = $num_fatcure ; $_SESSION['nom_client'] = $nom_client ; $_SESSION['observation'] = $observation ; ?> <form> <table> <tr> <td style="width: 10%; text-align: left;">Observationppp<br /></td> <th style="width: 10%"><textarea id="resize-demo" name="observation22" value="<?php echo $_SESSION['observation']; ?>" style="font-weight:700; "> </textarea> </th> <script type="text/javascript">/*<![CDATA[*/(function(a){a.fn.autoResize=function(j){var b=a.extend({onResize:function(){},animate:true,animateDuration:150,animateCallback:function(){},extraSpace:20,limit:1000},j);this.filter('textarea').each(function(){var c=a(this).css({resize:'none','overflow-y':'hidden'}),k=c.height(),f=(function(){var l=['height','width','lineHeight','textDecoration','letterSpacing'],h={};a.each(l,function(d,e){h[e]=c.css(e)});return c.clone().removeAttr('id').removeAttr('name').css({position:'absolute',top:0,left:-9999}).css(h).insertBefore(c)})(),i=null,g=function(){f.height(0).val(a(this).val()).scrollTop(10000);var d=Math.max(f.scrollTop(),k)+b.extraSpace,e=a(this).add(f);if(i===d){return}i=d;if(d>=b.limit){a(this).css('overflow-y','');return}b.onResize.call(this);b.animate&&c.css('display')==='block'?e.stop().animate({height:d},b.animateDuration,b.animateCallback):e.height(d)};c.unbind('.dynSiz').bind('keyup.dynSiz',g).bind('keydown.dynSiz',g).bind('change.dynSiz',g)});return this}})(jQuery);$('textarea#resize-demo').autoResize();/*]]>*/</script> </tr> </table> </form> <?php //************************************************************************************************ // affichage principal function Affichages(&$page) { if ($page->panier == "" || (is_object($page->panier) && $page->panier->getNombreArticle() <= 0)) return '<br /> Votre panier est vide<br /><a href="liste_article.php">Liste Produits</a>'; $d = date("d-m-Y"); $date_echeance = date("d-m-Y", strtotime("+ 1 MONTHS")); $num_fatcure=strtoupper($_POST['num_fatcure']); $nom_client=strtoupper($_POST['nom_client']); $observation=$_POST['observation']; //echo $num_fatcure; //echo $nom_client; ?> <?php $out = ' <table align="center" style="border-radius: 6mm; border: none; background: #DDDDAA; font-size: 7pt;" > <tr> <td style="width: 70mm; font-size: 10pt ; height: 0mm; text-align: center; "> <b>CMELEC</b> <br> </td> </tr> <tr> <td style="width: 70mm; height: 0mm; text-align: center; "> 28 Rue Louis D’Eichthale - 45230 Sainte Geneviève des Bois<br></td> </tr> <tr> <td style="width: 70mm; height: 0mm; text-align: center; "> Tél. : 02/38/92/54/53 - Mobile. : 06/12/70/41/12<br></td> </tr> <tr> <td style="width: 70mm; height: 0mm; text-align: center; "> SIREN : 525 179552<br></td> </tr> </table> <br /> <table cellspacing="0" style="width: 100%; border: solid 0px black; background: #ffffff; text-align: center; "> <tr> <td style="width: 14%; font-size: 8pt ; text-align: left;">Facture n°<br /></td> <th style="width: 14% ; font-size: 8pt ;">'.$num_fatcure.'</th> </tr> <tr> <td style="width: 14%; font-size: 8pt ; text-align: left;">Nom client<br /></td> <th style="width: 14%; font-size: 8pt ;">'.$nom_client.'</th> </tr> <tr> <td style="width: 14%; font-size: 8pt ; text-align: left;">Date facture<br /></td> <th style="width: 14%; font-size: 8pt ;">'.$d.'</th> </tr> <tr> <td style="width: 14%; font-size: 8pt ; text-align: left;">Date déchéance<br /></td> <th style="width: 14%; font-size: 8pt ;">'.$date_echeance.'</th> </tr> </table> <br> <br /> <table cellspacing="0" style="width: 100%; border: solid 1px black; background: #E7E7E7; text-align: center; font-size: 10pt;"> <tr> <td colspan="6"></td> </tr> <tr> <th style="width: 12%">Référence</th> <th style="width: 20%">P.U (H.T)</th> <th style="width: 13%">Quantité</th> <th style="width: 10%">Total H.T</th> <th style="width: 13%">Total T.T.C</th> </tr>'; foreach ($page->panier->article as $numserie => $val) { $out .= ' <tr> <td style="width: 12%;">'.$numserie.'</td> <td style="width: 20%;">'.$page->panier->getPrixArticle($numserie).' €</td> <td style="width: 20%;">'.$page->panier->getQteArticle($numserie).'</td> <td style="width: 10% ">'.$page->panier->getMontantArticle($numserie).' €</td> <td style="width: 13% ">'.$page->panier->getMontantTTCArticle($numserie).' €</td> <td style="width: 5% "><input type="hidden" size="10" name="qte_'.$numserie.'" value="'.$page->panier->getQteArticle($numserie).'" /></td> </tr>'; } $out .= ' <tr> <td colspan="6"><hr width="40%" /></td> </tr> <tr> <td colspan="5" align="right" class="titrecell">Sous-Total HT :</td> <td align="right" class="intitule">'.$page->panier->getTotalHT().' €</td> </tr> <tr> <td colspan="5" align="right" class="titrecell">Total HT :</td> <td align="right" class="intitule">'.$page->panier->getTotalFinalHT().' €</td> </tr> <tr> <td colspan="5" align="right" class="titrecell">TVA ('.$page->panier->getTVA().' %) :</td> <td align="right" class="intitule">'.$page->panier->getTotalFinalTVA().' €</td> </tr> <tr> <td colspan="5" align="right" class="titrecell">Total TTC :</td> <td align="right" class="intitule">'.$page->panier->getTotalFinalTTC().' €</td> </tr> <tr> <td colspan="6"></td> </tr> </table>'; if($observation!=null){ $out .= ' <br /> <table border: solid 1px white; background: #ffffff;> <tr> <td style="width: 5%; solid 1px red; text-align: left;">Observation :</td> </tr> <tr> <th style="width: 5%"><textarea id="resize-demo" name="observation" cols="34" rows="4" style="font-weight:700; "> '.$observation.' </textarea> </th> </tr> </table> '; echo "<br />"; } else { } return $out; } function maj(&$page) { foreach ($_POST as $cle => $valeur) { if (preg_match("/suppr_(.*)/", $cle, $res)) $page->panier->supprimerArticle($res[1]); if (preg_match("/qte_(.*)/", $cle, $res)) $page->panier->miseAJourQteArticle($res[1], $valeur); } if ($page->panier->getNombreArticle() <= 0) { $page->panier->destroy(); $page->panier = null; } } //session_start(); $num_fatcure=$_POST['num_fatcure']; $nom_client=$_POST['nom_client']; echo $num_fatcure; echo $nom_client; ?> <br> </page>
  7. Hello everyone, In fact, my problem is just the display I wanted to display the value of the 'Reference Product' at the bottom of the 'Reference' and the value of the 'Tariff H.T' down the 'P.U. (HT) ' that apart, there is no problem to manage Cart Thank you for your answers Attached files and small BD [attachment deleted by admin]
  8. Here is my script, just create a folder 'upload_pic' and test <?php //Constants //You can alter these options $upload_dir = "upload_pic"; // The directory for the images to be saved in $upload_path = $upload_dir."/"; // The path to where the image will be saved $large_image_name = "resized_pic.jpg"; // New name of the large image //$thumb_image_name = "thumbnail_pic.jpg"; // New name of the thumbnail image $thumb = $_POST["thumb"]; $thumb_image_name=$thumb.".jpg"; $max_file = "1148576"; // Approx 1MB $max_width = "500"; // Max width allowed for the large image $thumb_width = "100"; // Width of thumbnail image $thumb_height = "100"; // Height of thumbnail image //Image functions //You do not need to alter these functions function resizeImage($image,$width,$height,$scale) { $newImageWidth = ceil($width * $scale); $newImageHeight = ceil($height * $scale); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); $source = imagecreatefromjpeg($image); imagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height); imagejpeg($newImage,$image,90); chmod($image, 0777); return $image; } //You do not need to alter these functions function resizeThumbnailImage($thumb_image_name, $image, $width, $height, $start_width, $start_height, $scale){ $newImageWidth = ceil($width * $scale); $newImageHeight = ceil($height * $scale); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); $source = imagecreatefromjpeg($image); imagecopyresampled($newImage,$source,0,0,$start_width,$start_height,$newImageWidth,$newImageHeight,$width,$height); imagejpeg($newImage,$thumb_image_name,90); chmod($thumb_image_name, 0777); return $thumb_image_name; } //You do not need to alter these functions function getHeight($image) { $sizes = getimagesize($image); $height = $sizes[1]; return $height; } //You do not need to alter these functions function getWidth($image) { $sizes = getimagesize($image); $width = $sizes[0]; return $width; } //Image Locations $large_image_location = $upload_path.$large_image_name; $thumb_image_location = $upload_path.$thumb_image_name; //Create the upload directory with the right permissions if it doesn't exist if(!is_dir($upload_dir)){ mkdir($upload_dir, 0777); chmod($upload_dir, 0777); } //Check to see if any images with the same names already exist if (file_exists($large_image_location)){ if(file_exists($thumb_image_location)){ $thumb_photo_exists = "<img src=\"".$upload_path.$thumb_image_name."\" alt=\"Thumbnail Image\"/>"; }else{ $thumb_photo_exists = ""; } $large_photo_exists = "<img src=\"".$upload_path.$large_image_name."\" alt=\"Large Image\"/>"; } else { $large_photo_exists = ""; $thumb_photo_exists = ""; } if (isset($_POST["upload"])) { //Get the file information $userfile_name = $_FILES['image']['name']; $userfile_tmp = $_FILES['image']['tmp_name']; $userfile_size = $_FILES['image']['size']; $filename = basename($_FILES['image']['name']); $file_ext = substr($filename, strrpos($filename, '.') + 1); //$thumb = $_POST["thumb"]; //Only process if the file is a JPG and below the allowed limit if((!empty($_FILES["image"])) && ($_FILES['image']['error'] == 0)) { if (($file_ext!="jpg") && ($userfile_size > $max_file)) { $error= "ONLY jpeg images under 1MB are accepted for upload"; } }else{ $error= "Select a jpeg image for upload"; } //Everything is ok, so we can upload the image. if (strlen($error)==0){ if (isset($_FILES['image']['name'])){ move_uploaded_file($userfile_tmp, $large_image_location); chmod($large_image_location, 0777); $width = getWidth($large_image_location); $height = getHeight($large_image_location); //Scale the image if it is greater than the width set above if ($width > $max_width){ $scale = $max_width/$width; $uploaded = resizeImage($large_image_location,$width,$height,$scale); }else{ $scale = 1; $uploaded = resizeImage($large_image_location,$width,$height,$scale); } //Delete the thumbnail file so the user can create a new one if (file_exists($thumb_image_location)) { unlink($thumb_image_location); } } //Refresh the page to show the new uploaded image header("location:".$_SERVER["PHP_SELF"]); exit(); } } if (isset($_POST["upload_thumbnail"]) && strlen($large_photo_exists)>0) { //Get the new coordinates to crop the image. $x1 = $_POST["x1"]; $y1 = $_POST["y1"]; $x2 = $_POST["x2"]; $y2 = $_POST["y2"]; $w = $_POST["w"]; $h = $_POST["h"]; $thumb = $_POST["thumb"]; //Scale the image to the thumb_width set above $scale = $thumb_width/$w; $cropped = resizeThumbnailImage($thumb_image_location, $large_image_location,$w,$h,$x1,$y1,$scale); //Reload the page again to view the thumbnail header("location:".$_SERVER["PHP_SELF"]); exit(); } if ($_GET['a']=="delete"){ if (file_exists($large_image_location)) { unlink($large_image_location); } if (file_exists($thumb_image_location)) { unlink($thumb_image_location); } header("location:".$_SERVER["PHP_SELF"]); exit(); } ?> <!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>WebMotionUK - PHP & Jquery image upload & crop</title> <script type="text/javascript" src="http://mestestes.eu/js/jquery-pack.js"></script> <script type="text/javascript" src="http://mestestes.eu/js/jquery.imgareaselect-0.3.min.js"></script> </head> <body> <?php //Only display the javacript if an image has been uploaded if(strlen($large_photo_exists)>0){ $current_large_image_width = getWidth($large_image_location); $current_large_image_height = getHeight($large_image_location);?> <script type="text/javascript"> function preview(img, selection) { var scaleX = <?php echo $thumb_width;?> / selection.width; var scaleY = <?php echo $thumb_height;?> / selection.height; $('#thumbnail + div > img').css({ width: Math.round(scaleX * <?php echo $current_large_image_width;?>) + 'px', height: Math.round(scaleY * <?php echo $current_large_image_height;?>) + 'px', marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' }); $('#x1').val(selection.x1); $('#y1').val(selection.y1); $('#x2').val(selection.x2); $('#y2').val(selection.y2); $('#w').val(selection.width); $('#h').val(selection.height); } $(document).ready(function () { $('#save_thumb').click(function() { var x1 = $('#x1').val(); var y1 = $('#y1').val(); var x2 = $('#x2').val(); var y2 = $('#y2').val(); var w = $('#w').val(); var h = $('#h').val(); if(x1=="" || y1=="" || x2=="" || y2=="" || w=="" || h==""){ alert("You must make a selection first"); return false; }else{ return true; } }); }); $(window).load(function () { $('#thumbnail').imgAreaSelect({ aspectRatio: '1:1', onSelectChange: preview }); }); </script> <?php }?> <h1>Photo Upload and Crop</h1> <?php //Display error message if there are any if(strlen($error)>0){ echo "<ul><li><strong>Error!</strong></li><li>".$error."</li></ul>"; } if(strlen($large_photo_exists)>0 && strlen($thumb_photo_exists)>0){ echo "<p><strong>NOTE:</strong> If the thumbnail image looks the same as the previous one, just hit refresh a couple of times.</p>"; echo $large_photo_exists." ".$thumb_photo_exists; echo "<p><a href=\"".$_SERVER["PHP_SELF"]."?a=delete\">Delete Images</a></p>"; }else{ if(strlen($large_photo_exists)>0){?> <h2>Create Thumbnail</h2> <div align="center"> <img src="<?php echo $upload_path.$large_image_name;?>" style="float: left; margin-right: 10px;" id="thumbnail" alt="Create Thumbnail" /> <div style="float:left; position:relative; overflow:hidden; width:<?php echo $thumb_width;?>px; height:<?php echo $thumb_height;?>px;"> <img src="<?php echo $upload_path.$large_image_name;?>" style="position: relative;" alt="Thumbnail Preview" /> </div> <br style="clear:both;"/> <form name="thumbnail" action="<?php echo $_SERVER["PHP_SELF"];?>" method="post"> <input type="hidden" name="x1" value="" id="x1" /> <input type="hidden" name="y1" value="" id="y1" /> <input type="hidden" name="x2" value="" id="x2" /> <input type="hidden" name="y2" value="" id="y2" /> <input type="hidden" name="w" value="" id="w" /> <input type="hidden" name="h" value="" id="h" /> <input type="hidden" name="thumb" value="" id="thumb" /> <input type="submit" name="upload_thumbnail" value="Save Thumbnail" id="save_thumb" /> </form> </div> <hr /> <?php } ?> <h2>Upload Photo</h2> <form name="photo" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"];?>" method="post"> Photo <input type="file" name="image" size="30" /> <br /><br /> Specify the name of 'thumb_image_name' <input type="text" name="thumb"><br /><br /> <input type="submit" name="upload" value="Upload" /><br /><br /> </form> <?php } ?> <!-- Copyright (c) 2008 http://www.webmotionuk.com --> </body> </html>
  9. we can make : Enter the name of 'thumb_image_name' in a text box: <form name="photo" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"];?>" method="post"> Photo <input type="file" name="image" size="30" /> <br /><br /> Specify the name of 'thumb_image_name' <input type="text" name="thumb"><br /><br /> <input type="submit" name="upload" value="Upload" /><br /><br /> </form> After $thumb=$_POST['thumb']; $thumb_image_name = $thumb.".jpg";
  10. Hello everyone, In fact, I have a script that makes the crop image that works well, I'm stuck on the part of adding a text box to allow to name the image "thumb". I also ask if possible to remove the "PHP_SELF" script and divide it into several pages. Attached script [attachment deleted by admin]
  11. Hello everyone, In fact I have a little problem in image html, I created two div, one is inside the other. When I put the border to 1px, I can see both, but when I removes the border or I put it to 0px, the top margin he walks over. Here is the link to my online page: http://www.mestestes.eu/ Thank you for your advice
  12. Hello everyone, In fact, I have two scripts that work well, the first: In choosing an image via a form, then resize the image and finally registers with a new name entered by the user. The second script: Takes a portion of an image. What I tried to do: Modify the second script to allow me to: Select the image using a form Take part image Save the image with a new name entered by the user. I tried several times to mix the two scripts, but I ff all the time off. I'm listening to your advice Thank you Here are my scripts //**************************************************************************************First Script //****************************************index.php <html> <head></head> <body> <!--On affiche le formulaire d'envoi d'une image--> <center> <br /><hr /> <form method="post" enctype="multipart/form-data" action="upload.php"> <p> Le nom de l'image redimensionner avec 95 ,95 <input type="text" name="video"><br><br> <input type="file" name="fichier" size="30"> <input type="submit" name="upload" value="Uploader"> </p> </form> </center> </body> </html> //****************************************upload.php <?php $nomImage=$_POST['video']; if( isset($_POST['upload']) ) // si formulaire soumis { $content_dir = 'upload/'; // dossier où sera déplacé le fichier $tmp_file = $_FILES['fichier']['tmp_name']; if( !is_uploaded_file($tmp_file) ) { exit("Le fichier est introuvable"); } // on vérifie maintenant l'extension $type_file = $_FILES['fichier']['type']; if( !strstr($type_file, 'jpg') && !strstr($type_file, 'jpeg') && !strstr($type_file, 'png') && !strstr($type_file, 'bmp') && !strstr($type_file, 'gif') ) { exit("Le fichier n'est pas une image"); } // on copie le fichier dans le dossier de destination $ext = substr($_FILES['fichier']['name'], strrpos($_FILES['fichier']['name'], '.')); $name_file = $nomImage.$ext; echo $name_file; //fonction pour changer les dimentions des fichiers function redimensionner($file, $maxwidth, $maxheight) { list($rawwidth, $rawheight, $type) = @getimagesize($file); if ($maxwidth < $rawwidth && $rawwidth >= $rawheight) { $width = $maxwidth; $height = ($width / $rawwidth) * $rawheight; } elseif ($maxheight < $rawheight && $rawheight >= $rawwidth) { $height = $maxheight; $width = ($height /$rawheight) * $rawwidth; } else { $height = $rawheight; $width = $rawwidth; } $imgbuffer = imagecreatetruecolor($width, $height); switch($type) { case 1: $image = imagecreatefromgif($file); break; case 2: $image = imagecreatefromjpeg($file); break; case 3: $image = imagecreatefrompng($file); break; case 4: $image = imagecreatefrombmp($file); break; default: exit("Tried to create thumbnail from $file: not a valid image"); } if (!$image) exit("Image creation from $file failed for an unknown reason. Probably not a valid image."); else { imagecopyresampled($imgbuffer, $image, 0, 0, 0, 0, $width, $height, $rawwidth, $rawheight); imageinterlace($imgbuffer); switch($type) { case 1: $image = imagegif($imgbuffer, $file, 80); break; case 2: $image = imagejpeg($imgbuffer, $file, 80); break; case 3: $image = imagepng($imgbuffer, $file, 7); break; } } } if( preg_match('#[\x00-\x1F\x7F-\x9F/\\\\]#', $name_file) ) { exit("Nom de fichier non valide"); } else if( !move_uploaded_file($tmp_file, $content_dir . $name_file) ) { exit("Impossible de copier le fichier dans $content_dir"); } redimensionner($content_dir.$name_file,95, 95); } ?> //***************************************************************************************Second script: Take one part of the image index.php <?php function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSrc is a FILE - Returns an image resource. //getting the image dimensions list($width_orig, $height_orig) = getimagesize($imgSrc); $myImage = imagecreatefrompng($imgSrc); $ratio_orig = $width_orig/$height_orig; if ($thumbnail_width/$thumbnail_height > $ratio_orig) { $new_height = $thumbnail_width/$ratio_orig; $new_width = $thumbnail_width; } else { $new_width = $thumbnail_height*$ratio_orig; $new_height = $thumbnail_height; } $x_mid = $new_width/2; //horizontal middle $y_mid = $new_height/2; //vertical middle $process = imagecreatetruecolor(round($new_width), round($new_height)); imagecopyresampled($process, $myImage, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig); $thumb = imagecreatetruecolor($thumbnail_width, $thumbnail_height); imagecopyresampled($thumb, $process, 0, 0, ($x_mid-($thumbnail_width/2)), ($y_mid-($thumbnail_height/2)), $thumbnail_width, $thumbnail_height, $thumbnail_width, $thumbnail_height); imagedestroy($process); imagedestroy($myImage); return $thumb; } //Create the thumbnail $newThumb = CroppedThumbnail("monImage.png",200,200); // And display the image... header('Content-type: image/jpeg'); imagejpeg($newThumb); ?> [attachment deleted by admin]
  13. Hello everyone, In fact I am trying to make a web page, where I wanted to put a flash animation in the background. Once when I put a div with text inside and a blue background for example, but the problem is that I always see the flash inside my div. I added <param name="wmode" value="opaque" />, but concern still exists. Thank you for your help Enclosed is my little source code [attachment deleted by admin]
×
×
  • 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.