drisate
Members-
Posts
805 -
Joined
-
Last visited
Everything posted by drisate
-
aaaaa lol it was the imgCt var ... doh !!! thx anuway lol
-
Hey guys. i have a web page that needs to rotate 8 banner images with each it's own link. I managed to create a working code but i am facing a very weird problem. sometimes the images return an undifined error. Heres the HTML Output <script type="text/javascript"> var imgs1 = new Array("http://proprio-media.com/administrator/uploads/860749150x250-02.jpg", "http://proprio-media.com/administrator/uploads/636470laval3.jpg"); var lnks1 = new Array("http://", "http://"); var alt1 = new Array("860749150x250-02.jpg", "636470laval3.jpg"); var currentAd1 = 0; var imgCt1 = 3; function cycle1() { if (currentAd1 == imgCt1) { currentAd1 = 0; } var banner1 = document.getElementById('adBanner1'); var link1 = document.getElementById('adLink1'); banner1.src=imgs1[currentAd1] banner1.alt=alt1[currentAd1] document.getElementById('adLink1').href=lnks1[currentAd1] currentAd1++; } window.setInterval("cycle1()",10000); var imgs2 = new Array("http://proprio-media.com/administrator/uploads/835152Rive-Sud4.jpg", "http://proprio-media.com/administrator/uploads/519177Rive-Sud4.jpg", "http://proprio-media.com/administrator/uploads/869400laurentide4.jpg"); var lnks2 = new Array("http://", "http://", "http://"); var alt2 = new Array("835152Rive-Sud4.jpg", "519177Rive-Sud4.jpg", "869400laurentide4.jpg"); var currentAd2 = 0; var imgCt2 = 3; function cycle2() { if (currentAd2 == imgCt2) { currentAd2 = 0; } var banner2 = document.getElementById('adBanner2'); var link2 = document.getElementById('adLink2'); banner2.src=imgs2[currentAd2] banner2.alt=alt2[currentAd2] document.getElementById('adLink2').href=lnks2[currentAd2] currentAd2++; } window.setInterval("cycle2()",10000); var imgs3 = new Array("http://proprio-media.com/administrator/uploads/317794Rive-Sud2.jpg", "http://proprio-media.com/administrator/uploads/214150laval3.jpg"); var lnks3 = new Array("http://", "http://"); var alt3 = new Array("317794Rive-Sud2.jpg", "214150laval3.jpg"); var currentAd3 = 0; var imgCt3 = 3; function cycle3() { if (currentAd3 == imgCt3) { currentAd3 = 0; } var banner3 = document.getElementById('adBanner3'); var link3 = document.getElementById('adLink3'); banner3.src=imgs3[currentAd3] banner3.alt=alt3[currentAd3] document.getElementById('adLink3').href=lnks3[currentAd3] currentAd3++; } window.setInterval("cycle3()",10000); var imgs4 = new Array("http://proprio-media.com/administrator/uploads/386411Rive-Sud2.jpg"); var lnks4 = new Array("http://"); var alt4 = new Array("386411Rive-Sud2.jpg"); var currentAd4 = 0; var imgCt4 = 3; function cycle4() { if (currentAd4 == imgCt4) { currentAd4 = 0; } var banner4 = document.getElementById('adBanner4'); var link4 = document.getElementById('adLink4'); banner4.src=imgs4[currentAd4] banner4.alt=alt4[currentAd4] document.getElementById('adLink4').href=lnks4[currentAd4] currentAd4++; } window.setInterval("cycle4()",10000); var imgs5 = new Array(); var lnks5 = new Array(); var alt5 = new Array(); var currentAd5 = 0; var imgCt5 = 3; function cycle5() { if (currentAd5 == imgCt5) { currentAd5 = 0; } var banner5 = document.getElementById('adBanner5'); var link5 = document.getElementById('adLink5'); banner5.src=imgs5[currentAd5] banner5.alt=alt5[currentAd5] document.getElementById('adLink5').href=lnks5[currentAd5] currentAd5++; } window.setInterval("cycle5()",10000); var imgs6 = new Array("http://proprio-media.com/administrator/uploads/693145laval1.jpg"); var lnks6 = new Array("http://"); var alt6 = new Array("693145laval1.jpg"); var currentAd6 = 0; var imgCt6 = 3; function cycle6() { if (currentAd6 == imgCt6) { currentAd6 = 0; } var banner6 = document.getElementById('adBanner6'); var link6 = document.getElementById('adLink6'); banner6.src=imgs6[currentAd6] banner6.alt=alt6[currentAd6] document.getElementById('adLink6').href=lnks6[currentAd6] currentAd6++; } window.setInterval("cycle6()",10000); var imgs7 = new Array("http://proprio-media.com/administrator/uploads/304925laurentide3.jpg"); var lnks7 = new Array("http://"); var alt7 = new Array("304925laurentide3.jpg"); var currentAd7 = 0; var imgCt7 = 3; function cycle7() { if (currentAd7 == imgCt7) { currentAd7 = 0; } var banner7 = document.getElementById('adBanner7'); var link7 = document.getElementById('adLink7'); banner7.src=imgs7[currentAd7] banner7.alt=alt7[currentAd7] document.getElementById('adLink7').href=lnks7[currentAd7] currentAd7++; } window.setInterval("cycle7()",10000); var imgs8 = new Array("http://proprio-media.com/administrator/uploads/228557montreal3.jpg"); var lnks8 = new Array("http://"); var alt8 = new Array("228557montreal3.jpg"); var currentAd8 = 0; var imgCt8 = 3; function cycle8() { if (currentAd8 == imgCt8) { currentAd8 = 0; } var banner8 = document.getElementById('adBanner8'); var link8 = document.getElementById('adLink8'); banner8.src=imgs8[currentAd8] banner8.alt=alt8[currentAd8] document.getElementById('adLink8').href=lnks8[currentAd8] currentAd8++; } window.setInterval("cycle8()",10000); </script> <a href="http://www." id="adLink1" target="_top"> <img src="http://proprio-media.com/administrator/uploads/860749150x250-02.jpg" id="adBanner1" border="0"></a> <br><br> <a href="http://www." id="adLink2" target="_top"> <img src="http://proprio-media.com/administrator/uploads/835152Rive-Sud4.jpg" id="adBanner2" border="0"></a> <br><br> <a href="http://www." id="adLink3" target="_top"> <img src="http://proprio-media.com/administrator/uploads/317794Rive-Sud2.jpg" id="adBanner3" border="0"></a> <br><br> <a href="http://www." id="adLink4" target="_top"> <img src="http://proprio-media.com/administrator/uploads/386411Rive-Sud2.jpg" id="adBanner4" border="0"></a> <br><br> <a href="http://www." id="adLink6" target="_top"> <img src="http://proprio-media.com/administrator/uploads/693145laval1.jpg" id="adBanner6" border="0"></a> <br><br> <a href="http://www." id="adLink7" target="_top"> <img src="http://proprio-media.com/administrator/uploads/304925laurentide3.jpg" id="adBanner7" border="0"></a> <br><br> <a href="http://www." id="adLink8" target="_top"> <img src="http://proprio-media.com/administrator/uploads/228557montreal3.jpg" id="adBanner8" border="0"></a> Copy the code to an html page and try it under IE and you should ee the problem after a few image switch.
-
hmm looks like i finaly made it ... it was the javascript array lol var imgs<?=$counter?> = new Array(<?php unset($img); $select = mysql_query("SELECT * FROM pub where num='$counter'") or die(mysql_error()); while ($pub = mysql_fetch_array($select)) { $img = $img.'"http://proprio-media.com/administrator/uploads/'.$pub[photo].'", '; } echo substr($img, 0, -2); ?>); var lnks<?=$counter?> = new Array(<?php unset($url); $select = mysql_query("SELECT * FROM pub where num='$counter'") or die(mysql_error()); while ($pub = mysql_fetch_array($select)) { $url = $url.'"http://'.$pub[url].'", '; } echo substr($url, 0, -2); ?>); var alt<?=$counter?> = new Array(<?php unset($alt); $select = mysql_query("SELECT * FROM pub where num='$counter'") or die(mysql_error()); while ($pub = mysql_fetch_array($select)) { $alt = $alt.'"'.$pub[photo].'", '; } echo substr($alt, 0, -2); ?>);
-
Hey guys i need to create a page with a total of 8 banners one under an other rotating ... I am having a very hard time making Javascript and PHP work to gether. I managed to create this but the rotating is not working and i gething out of option. the Javascript code works greate with out PHP ... but when i try to make it dynamique with MySQL info thats where it breaks... what did i do wroung? PHP code /////////////////////////////////////////////// ?> <script type="text/javascript"> <?php $counter = 1; while ( $counter <= 8 ) { ?> var imgs<?=$counter?> = new Array("<?php $select = mysql_query("SELECT * FROM pub where num='$counter'") or die(mysql_error()); while ($pub = mysql_fetch_array($select)) { $img = $img."http://proprio-media.com/administrator/uploads/$pub[photo], "; } echo substr($img, 0, -2); unset($img); ?>"); var lnks<?=$counter?> = new Array("<?php $select = mysql_query("SELECT * FROM pub where num='$counter'") or die(mysql_error()); while ($pub = mysql_fetch_array($select)) { $url = $url."http://$pub[url], "; } echo substr($url, 0, -2); unset($url); ?>"); var alt<?=$counter?> = new Array("<?php $select = mysql_query("SELECT * FROM pub where num='$counter'") or die(mysql_error()); while ($pub = mysql_fetch_array($select)) { $alt = $alt."$pub[url], "; } echo substr($alt, 0, -2); unset($alt); ?>"); var currentAd<?=$counter?> = 0; var imgCt<?=$counter?> = 3; function cycle<?=$counter?>() { if (currentAd<?=$counter?> == imgCt<?=$counter?>) { currentAd<?=$counter?> = 0; } var banner<?=$counter?> = document.getElementById('adBanner<?=$counter?>'); var link<?=$counter?> = document.getElementById('adLink<?=$counter?>'); banner<?=$counter?>.src=imgs<?=$counter?>[currentAd<?=$counter?>] banner<?=$counter?>.alt=alt<?=$counter?>[currentAd<?=$counter?>] document.getElementById('adLink<?=$counter?>').href=lnks<?=$counter?>[currentAd<?=$counter?>] currentAd<?=$counter?>++; } window.setInterval("cycle<?=$counter?>()",10000); <?php $counter++; } ?> </script> <? $counter = 1; while ( $counter <= 8 ) { $pu = @mysql_fetch_assoc(@mysql_query("SELECT * FROM pub where num='$counter' order by id asc limit 1")); ?> <a href="http://www.<?=$pu[url]?>" id="adLink<?=$counter?>" target="_top"> <img src="http://proprio-media.com/administrator/uploads/<?=$pu[photo]?>" id="adBanner<?=$counter?>" border="0"></a> <br><br> <?php $counter++; } /////////////////////////////////////////////// HTML OUTPUT <script type="text/javascript"> var imgs1 = new Array("http://proprio-media.com/administrator/uploads/473253laurentide2.jpg, http://proprio-media.com/administrator/uploads/860749150x250-02.jpg, http://proprio-media.com/administrator/uploads/636470laval3.jpg"); var lnks1 = new Array("http://, http://, http://"); var alt1 = new Array(", , "); var currentAd1 = 0; var imgCt1 = 3; function cycle1() { if (currentAd1 == imgCt1) { currentAd1 = 0; } var banner1 = document.getElementById('adBanner1'); var link1 = document.getElementById('adLink1'); banner1.src=imgs1[currentAd1] banner1.alt=alt1[currentAd1] document.getElementById('adLink1').href=lnks1[currentAd1] currentAd1++; } window.setInterval("cycle1()",10000); var imgs2 = new Array("http://proprio-media.com/administrator/uploads/835152Rive-Sud4.jpg, http://proprio-media.com/administrator/uploads/519177Rive-Sud4.jpg, http://proprio-media.com/administrator/uploads/869400laurentide4.jpg"); var lnks2 = new Array("http://, http://, http://"); var alt2 = new Array(", , "); var currentAd2 = 0; var imgCt2 = 3; function cycle2() { if (currentAd2 == imgCt2) { currentAd2 = 0; } var banner2 = document.getElementById('adBanner2'); var link2 = document.getElementById('adLink2'); banner2.src=imgs2[currentAd2] banner2.alt=alt2[currentAd2] document.getElementById('adLink2').href=lnks2[currentAd2] currentAd2++; } window.setInterval("cycle2()",10000); var imgs3 = new Array("http://proprio-media.com/administrator/uploads/317794Rive-Sud2.jpg, http://proprio-media.com/administrator/uploads/214150laval3.jpg, http://proprio-media.com/administrator/uploads/370317150x250-07.jpg"); var lnks3 = new Array("http://, http://, http://"); var alt3 = new Array(", , "); var currentAd3 = 0; var imgCt3 = 3; function cycle3() { if (currentAd3 == imgCt3) { currentAd3 = 0; } var banner3 = document.getElementById('adBanner3'); var link3 = document.getElementById('adLink3'); banner3.src=imgs3[currentAd3] banner3.alt=alt3[currentAd3] document.getElementById('adLink3').href=lnks3[currentAd3] currentAd3++; } window.setInterval("cycle3()",10000); var imgs4 = new Array("http://proprio-media.com/administrator/uploads/897292montreal1.jpg, http://proprio-media.com/administrator/uploads/386411Rive-Sud2.jpg"); var lnks4 = new Array("http://, http://"); var alt4 = new Array(", "); var currentAd4 = 0; var imgCt4 = 3; function cycle4() { if (currentAd4 == imgCt4) { currentAd4 = 0; } var banner4 = document.getElementById('adBanner4'); var link4 = document.getElementById('adLink4'); banner4.src=imgs4[currentAd4] banner4.alt=alt4[currentAd4] document.getElementById('adLink4').href=lnks4[currentAd4] currentAd4++; } window.setInterval("cycle4()",10000); var imgs5 = new Array("http://proprio-media.com/administrator/uploads/534149Rive-Sud1.jpg, http://proprio-media.com/administrator/uploads/"); var lnks5 = new Array("http://, http://"); var alt5 = new Array(", "); var currentAd5 = 0; var imgCt5 = 3; function cycle5() { if (currentAd5 == imgCt5) { currentAd5 = 0; } var banner5 = document.getElementById('adBanner5'); var link5 = document.getElementById('adLink5'); banner5.src=imgs5[currentAd5] banner5.alt=alt5[currentAd5] document.getElementById('adLink5').href=lnks5[currentAd5] currentAd5++; } window.setInterval("cycle5()",10000); var imgs6 = new Array("http://proprio-media.com/administrator/uploads/646964laurentide2.jpg, http://proprio-media.com/administrator/uploads/693145laval1.jpg"); var lnks6 = new Array("http://, http://"); var alt6 = new Array(", "); var currentAd6 = 0; var imgCt6 = 3; function cycle6() { if (currentAd6 == imgCt6) { currentAd6 = 0; } var banner6 = document.getElementById('adBanner6'); var link6 = document.getElementById('adLink6'); banner6.src=imgs6[currentAd6] banner6.alt=alt6[currentAd6] document.getElementById('adLink6').href=lnks6[currentAd6] currentAd6++; } window.setInterval("cycle6()",10000); var imgs7 = new Array("http://proprio-media.com/administrator/uploads/321567laval2.jpg, http://proprio-media.com/administrator/uploads/304925laurentide3.jpg"); var lnks7 = new Array("http://, http://"); var alt7 = new Array(", "); var currentAd7 = 0; var imgCt7 = 3; function cycle7() { if (currentAd7 == imgCt7) { currentAd7 = 0; } var banner7 = document.getElementById('adBanner7'); var link7 = document.getElementById('adLink7'); banner7.src=imgs7[currentAd7] banner7.alt=alt7[currentAd7] document.getElementById('adLink7').href=lnks7[currentAd7] currentAd7++; } window.setInterval("cycle7()",10000); var imgs8 = new Array("http://proprio-media.com/administrator/uploads/228557montreal3.jpg, http://proprio-media.com/administrator/uploads/829490montreal2.jpg"); var lnks8 = new Array("http://, http://"); var alt8 = new Array(", "); var currentAd8 = 0; var imgCt8 = 3; function cycle8() { if (currentAd8 == imgCt8) { currentAd8 = 0; } var banner8 = document.getElementById('adBanner8'); var link8 = document.getElementById('adLink8'); banner8.src=imgs8[currentAd8] banner8.alt=alt8[currentAd8] document.getElementById('adLink8').href=lnks8[currentAd8] currentAd8++; } window.setInterval("cycle8()",10000); </script> <a href="http://www." id="adLink1" target="_top"> <img src="http://proprio-media.com/administrator/uploads/473253laurentide2.jpg" id="adBanner1" border="0"></a> <br><br> <a href="http://www." id="adLink2" target="_top"> <img src="http://proprio-media.com/administrator/uploads/835152Rive-Sud4.jpg" id="adBanner2" border="0"></a> <br><br> <a href="http://www." id="adLink3" target="_top"> <img src="http://proprio-media.com/administrator/uploads/317794Rive-Sud2.jpg" id="adBanner3" border="0"></a> <br><br> <a href="http://www." id="adLink4" target="_top"> <img src="http://proprio-media.com/administrator/uploads/897292montreal1.jpg" id="adBanner4" border="0"></a> <br><br> <a href="http://www." id="adLink5" target="_top"> <img src="http://proprio-media.com/administrator/uploads/534149Rive-Sud1.jpg" id="adBanner5" border="0"></a> <br><br> <a href="http://www." id="adLink6" target="_top"> <img src="http://proprio-media.com/administrator/uploads/646964laurentide2.jpg" id="adBanner6" border="0"></a> <br><br> <a href="http://www." id="adLink7" target="_top"> <img src="http://proprio-media.com/administrator/uploads/321567laval2.jpg" id="adBanner7" border="0"></a> <br><br> <a href="http://www." id="adLink8" target="_top"> <img src="http://proprio-media.com/administrator/uploads/228557montreal3.jpg" id="adBanner8" border="0"></a> <br><br>
-
trudat No the path is good look Script is here httpdocs/administration/inventaire.php The script is: photo($_FILES['userfile']['tmp_name'][$x],57,'../media/small/'.$rand.nomValide($_FILES['userfile']['name'][$x])); photo($_FILES['userfile']['tmp_name'][$x],79,'../media/medium/'.$rand.nomValide($_FILES['userfile']['name'][$x])); photo($_FILES['userfile']['tmp_name'][$x],300,'../media/big/'.$rand.nomValide($_FILES['userfile']['name'][$x])); photo($_FILES['userfile']['tmp_name'][$x],'original','../media/original/'.$rand.nomValide($_FILES['userfile']['name'][$x])); The files EXISTE and are all chomoded to 777 there location are: httpdocs/media httpdocs/media/big httpdocs/media/medium httpdocs/media/original httpdocs/media/small So the path is good has to be something else.
-
Thats impossible ... the script is located at: httpdocs/administration/inventaire.php The code that calls the function looks like this: $count = count($_FILES['userfile']['name']) - 1; //echo "Count is at :$count"; $x = 1; while ($x <= $count) { $rand = rand("1000", "90000") . "-"; //echo "- Image num: $x<br>"; if ($_FILES['userfile']['size'][$x] != "0") { echo "File name: $rand".$_FILES['userfile']['name'][$x]."<br>"; photo($_FILES['userfile']['tmp_name'][$x],57,'../media/small/'.$rand.nomValide($_FILES['userfile']['name'][$x])); photo($_FILES['userfile']['tmp_name'][$x],79,'../media/medium/'.$rand.nomValide($_FILES['userfile']['name'][$x])); photo($_FILES['userfile']['tmp_name'][$x],300,'../media/big/'.$rand.nomValide($_FILES['userfile']['name'][$x])); photo($_FILES['userfile']['tmp_name'][$x],'original','../media/original/'.$rand.nomValide($_FILES['userfile']['name'][$x])); $url=$rand.nomValide($_FILES['userfile']['name'][$x]); $insert = mysql_query("INSERT INTO photo (id, inv_id, photo, delfault) VALUE ('', '$last', '$url', '0')") or die(mysql_error()); } //echo "Relooping!<br>"; $x++; } All directorys exists and are chomoded to 777 httpdocs/media httpdocs/media/big httpdocs/media/medium httpdocs/media/original httpdocs/media/small the copy(Resource id # error is caused because Resource id #8 is not the value that is suposed to be there ... thats where the script fucks up. why is that there? and How to repaire it?
-
Hey guys i am having issues making this code work function photo($image,$largeur_maximum,$destination){ $autorises = 'gifjpegjpgpngGIFJPEGJPGPNG'; $extension = explode('.',$destination); $extension = strtolower($extension[sizeof($extension)-1]); if(ereg($extension,$autorises)){ $dimensions = getimagesize($image); $largeur_actuelle = $dimensions[0]; $hauteur_actuelle = $dimensions[1]; if ($largeur_maximum=="original"){ $nouvelle_largeur = $dimensions[0]; $nouvelle_hauteur = $dimensions[1]; }else{ if($largeur_actuelle > $largeur_maximum){ $nouvelle_largeur = $largeur_maximum; $nouvelle_hauteur = $hauteur_actuelle / ($largeur_actuelle / $largeur_maximum); } else { $nouvelle_largeur = $dimensions[0]; $nouvelle_hauteur = $dimensions[1]; } } if($extension == 'jpg' || $extension == 'jpeg'){ $image_p = imagecreatetruecolor($nouvelle_largeur, $nouvelle_hauteur); $image = imagecreatefromjpeg($image); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $nouvelle_largeur, $nouvelle_hauteur, $largeur_actuelle, $hauteur_actuelle); imagejpeg($image_p,$image); } else if($extension == 'gif'){ $image_p = imagecreatetruecolor($nouvelle_largeur, $nouvelle_hauteur); $image = imagecreatefromgif($image); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $nouvelle_largeur, $nouvelle_hauteur, $largeur_actuelle, $hauteur_actuelle); imagegif($image_p,$image); } else if($extension == 'png'){ $image_p = imagecreatetruecolor($nouvelle_largeur, $nouvelle_hauteur); $image = imagecreatefrompng($image); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $nouvelle_largeur, $nouvelle_hauteur, $largeur_actuelle, $hauteur_actuelle); imagepng($image_p,$image); } copy($image,$destination); } } This is teh error: Warning: imagejpeg() [function.imagejpeg]: Unable to open 'Resource id #8' for writing in /var/www/vhosts/automobilesdmr.com/httpdocs/administration/head.php on line 97 Warning: copy(Resource id # [function.copy]: failed to open stream: No such file or directory in /var/www/vhosts/automobilesdmr.com/httpdocs/administration/head.php on line 109 // line 97 imagejpeg($image_p,$image); // line 109 copy($image,$destination);
-
wow i managed to get those errors out of my code imagejpeg() [function.imagejpeg]: Unable to open 'Resource id #8' for writing copy(Resource id # [function.copy]: failed to open stream: No such file or directory imagejpeg() [function.imagejpeg]: Unable to open 'Resource id #12' for writing copy(Resource id #12) [function.copy]: failed to open stream: No such file or directory imagejpeg() [function.imagejpeg]: Unable to open 'Resource id #16' for writing copy(Resource id #16) [function.copy]: failed to open stream: No such file or directory why is $_FILES['userfile']['tmp_name'][$x] returning a Resource id?
-
Hey guys i have a javascript forme that lets the user create the number of photo upload box they need. I have been using this systeme in sevral other websites and now for some reason i am having problems using the form result ... I have 2 functions. The first une is to validate the name and the seconde one is to upload and resize. They both work because they are used elsewhere with no problems. function nomValide($tmp){ $accents = "ÀÃÂÃÄÅà áâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÃÃŽÃìÃîïÙÚÛÜùúûüÿÑñ"; $pasaccents = "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn"; $autorises = ".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; $tmp = strtr($tmp,$accents,$pasaccents); for($i=0;$i<strlen($tmp);$i++){ if(!ereg($tmp{$i},$autorises)){ $tmp = str_replace($tmp{$i},'_',$tmp); } } return $tmp; } function photo($image,$largeur_maximum,$destination){ $autorises = 'gifjpegjpgpngGIFJPEGJPGPNG'; $extension = explode('.',$destination); $extension = strtolower($extension[sizeof($extension)-1]); if(ereg($extension,$autorises)){ $dimensions = getimagesize($image); $largeur_actuelle = $dimensions[0]; $hauteur_actuelle = $dimensions[1]; if ($largeur_maximum=="original"){ $nouvelle_largeur = $dimensions[0]; $nouvelle_hauteur = $dimensions[1]; }else{ if($largeur_actuelle > $largeur_maximum){ $nouvelle_largeur = $largeur_maximum; $nouvelle_hauteur = $hauteur_actuelle / ($largeur_actuelle / $largeur_maximum); } else { $nouvelle_largeur = $dimensions[0]; $nouvelle_hauteur = $dimensions[1]; } } if($extension == 'jpg' || $extension == 'jpeg'){ $image_p = imagecreatetruecolor($nouvelle_largeur, $nouvelle_hauteur); $image = imagecreatefromjpeg($image); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $nouvelle_largeur, $nouvelle_hauteur, $largeur_actuelle, $hauteur_actuelle); imagejpeg($image_p,$image); } else if($extension == 'gif'){ $image_p = imagecreatetruecolor($nouvelle_largeur, $nouvelle_hauteur); $image = imagecreatefromgif($image); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $nouvelle_largeur, $nouvelle_hauteur, $largeur_actuelle, $hauteur_actuelle); imagegif($image_p,$image); } else if($extension == 'png'){ $image_p = imagecreatetruecolor($nouvelle_largeur, $nouvelle_hauteur); $image = imagecreatefrompng($image); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $nouvelle_largeur, $nouvelle_hauteur, $largeur_actuelle, $hauteur_actuelle); imagepng($image_p,$image); } copy($image,$destination); } } And now for the code it self: $count = count($_FILES['userfile']['name']) - 1; //echo "Count is at :$count"; $x = 1; while ($x <= $count) { $rand = rand("1000", "90000") . "-"; //echo "- Image num: $x<br>"; if ($_FILES['userfile']['size'][$x] != "0") { echo "File name: $rand".$_FILES['userfile']['name'][$x]."<br>"; @photo($_FILES['userfile']['tmp_name'][$x],57,'../media/small/'.$rand.nomValide($_FILES['userfile']['name'][$x])); @photo($_FILES['userfile']['tmp_name'][$x],79,'../media/medium/'.$rand.nomValide($_FILES['userfile']['name'][$x])); @photo($_FILES['userfile']['tmp_name'][$x],300,'../media/big/'.$rand.nomValide($_FILES['userfile']['name'][$x])); @photo($_FILES['userfile']['tmp_name'][$x],'original','../media/original/'.$rand.nomValide($_FILES['userfile']['name'][$x])); $url=$rand.nomValide($_FILES['userfile']['name'][$x]); $insert = mysql_query("INSERT INTO photo (id, inv_id, photo, delfault) VALUE ('', '$last', '$url', '0')") or die(mysql_error()); } //echo "Relooping!<br>"; $x++; } I made a few a lot of debuging and heres what makes me go crazy ... $count returns the correct number of loops to do. echo "File name: $rand".$_FILES['userfile']['name'][$x]."<br>"; Returns the filename so the $_FILES var is well initiated. I made a print($_FILES) and everything is ok The @ of @photo is because of the notice but i tryed taking out the @ and there no fatal errors just a few anoying notices. But like i previously sayd the function is working fine in other projets i made so the code works. The files is chomoded to 777 and the linux groupe acess is ok The INSERT INTO works great ... every images are added to the database. BUT ... for some reason no images are uploaded ... WTF? The acess path are all good... the code loops ... the files name appears, the funtion works WHY??? lol
-
nvm got it lol thx guys ;-) You rock!
-
Oh wow lol looks complicated ... my querry is already knid of big how do you adapte that to this? <?php $sql = "SELECT * FROM inscriptions WHERE (AGENT_INSCRIPTEUR_1='MT76440' OR AGENT_INSCRIPTEUR_2='MT76440' OR AGENT_INSCRIPTEUR_1='MT76440' OR AGENT_INSCRIPTEUR_2='MT76440') "; if(isset($_GET['MUN_CODE'])){ $sql = $sql . " and MUN_CODE='".$_GET['MUN_CODE']."'"; } if(isset($_GET['GENRE_PROPRIETE'])){ $sql = $sql . " and GENRE_PROPRIETE='".$_GET['GENRE_PROPRIETE']."'"; } if(!isset($_GET['MUN_CODE']) && !isset($_GET['GENRE_PROPRIETE']) && !isset($_GET['prix'])){ $sql = $sql . " ORDER BY MUN_CODE LIMIT $debut,$combienparpage;"; } echo $sql; $sql = mysql_query($sql); ?> the above gives SELECT * FROM inscriptions WHERE (AGENT_INSCRIPTEUR_1='MT76440' OR AGENT_INSCRIPTEUR_2='MT76440' OR AGENT_INSCRIPTEUR_1='MT76440' OR AGENT_INSCRIPTEUR_2='MT76440') ORDER BY MUN_CODE LIMIT 0,10; I wana keep the rows wher MUN_CODE='66057' on top i tryed this but it's returning no results SELECT *,(CASE SUBSTR(MUN_CODE,1,1) WHEN '66057' THEN 0 ELSE 1 END) as sorter FROM inscriptions WHERE (AGENT_INSCRIPTEUR_1='MT76440' OR AGENT_INSCRIPTEUR_2='MT76440' OR AGENT_INSCRIPTEUR_1='MT76440' OR AGENT_INSCRIPTEUR_2='MT76440') ORDER BY as sorter, MUN_CODE LIMIT 0,10;
-
Hey guys ... how do you order by something but keep something else first ... select * from table order by ORDER BY MUN_CODE like = '66057', MUN_CODE I know the querry is not working it's just an exemple. In this case you order by MUN_CODE but you keep the 66057 on top
-
oooooo ... so simple >.< thx bro lol
-
Hey guys i am building a small search engin for my website. I need help in building the seach querry i have 2 tables. Categ: id name cronique Page: id image date I need to loop the pages where the id of the page is = to something in the cronique col of the table categ How the hell do i do that lol
-
i have a number like this 07 and i need it to be like this 7 is tehre a premade funtion in php to take out the front 0 ?
-
Hey guys i have a form that auto generates filds by a click on a botton if the user needs them. I normaly use an array in the field name to retrive the results ... but in this case i can't. The part auto generated is a WYSIWYG box and when i add the [] to the field name it breaks some code because it uses the name as i typed it into other parts. FAIL: id="texte[]___Config" FAIL: id="texte[]___Frame" FAIL: src="editor/fckeditor.html?InstanceName=texte[]&Toolbar=Basic" So i was wandering if it would be possible to get som helpp to figure out how to use the auto increment number of the generated field. Heres my coding: <script type="text/javascript" src="http://patrick.cameleonmedia.com/reno/administration/uploads.js"></script> <table border="0" cellpadding="3" cellspacing="3" width="100%" id="table12"> <tr> <td> <div id="attachments" class="container"><a id="addupload" href="javascript:addUpload(19, 'desc', 'file')">Add</a></div> </td> </tr> </table> <span id="attachmentmarker"></span> <div id="attachment" class="attachment" style="display:none"> <hr> <table border="0" cellpadding="3" cellspacing="3" width="100%" id="table12"> <tr> <td><textarea rows="13" name="texte[]" cols="61"></textarea></td> </tr> </table> </div> <table border="0" cellpadding="3" cellspacing="3" width="100%" id="table3"> <tr> <td align="center"><input type="submit" value="Envoyer" name="B1"></td> </tr> </table> In this exemple ia m using a normal textarea because the WYSIWYG code would be to big for nothing. I need to replace name="texte[]" by name="texte_5" or what ever number the auto increment is at.
-
Hey guys i need to use the FCK WYSIWYG posted as an array because the description field is autogenerated (if needed) by the user a number infit of times. The forme works greate but because of the way FCK was build, i am having a hard time making it possible. Has anybody used it before? FCK WYSIWYG $oFCKeditor = new FCKeditor('texte[]') ; Adding [] in teh name field causes a few problems in the way the HTML is generated. WORKS: id="texte[]" WORKS: name="texte[]" FAIL: id="texte[]___Config" FAIL: id="texte[]___Frame" FAIL: src="editor/fckeditor.html?InstanceName=texte[]&Toolbar=Basic" How can i work arround those fails? I tryed posting this question on there board but no support.
-
Hey guys, I am having problems with a query string causing problems with one of my codings in joomla. index.php?mod=registration When mod is equal to registration a script located inside the template replaces the page content by my custom registration form. That part works great. But when the visitor clicks on any other page before clicking my registration link this is added index.php?mod=registration&option=com_content&Itemid=41 That causes a 404 page not found error... option and Itemid seems to stick from one page to an other once it's activated. I tryed everything and have abselutly no idea why i have that probleme ... But i thung that is i can redirect from the htaccess that would save the headac from trying to find where it breaks. How can i redirect from the htacess if mod=registration and option to anything and Itemid to anything back to index.php?mod=registration
-
Hey guys, I am currently relying on a thind party website that offers a very bad service. So i was wandering how hard could it be to create my own small script to generate my own screenshots. I am hosted under linux at the moment. Anybody can pointe me in the right direction?
-
thx bro works great :-)
-
The best way to keep control over your stuff is to use the paypal IPN script http://www.tutorialhero.com/click-40811-easy_payments_using_paypal_ipn.php as for the button you just change the vars <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="paypal@your-web-domain.com"> <input type="hidden" name="quantity" value="1"> <input type="hidden" name="item_name" value="Item1-1"> <input type="hidden" name="amount" value="35.00"> <input type="hidden" name="shipping" value="2.99"> <input type="hidden" name="custom" value=""> <input type="hidden" name="return" value="http://your-web-domain.com/thanks-payment.htm"> <input type="submit" value="Purchase" onmouseover="this.className='buttonon-order'" onmouseout="this.className='button-order'" class="button-order">
-
Hey guys, I need to retreive the order number of the row before and after a given id... Table: id | name | order ----------------- 1 | patrick | 1 2 | miguel | 2 3 | michel | 3 let say i have id 2 as a reference. I need to retreive the order number 1 from patrick and 3 from michel (1 row before, 1 row after) Whats would be the SQL string for that?
-
Yeah thx bro that did it :-)