
anf.etienne
Members-
Posts
82 -
Joined
-
Last visited
Never
Everything posted by anf.etienne
-
Hi, i have a code that reads a directory and puts all the images within the directory into table format with links underneath. In my directories I have images that are named 1.jpg 2.jpg 3.jpg etc and i have images that are named 1b.jpg 2b.jpg 3b.jpg how can i change this code so that all the images with b.jpg is not included when the code is run to view images within a directory? <?php $r = 0; for($n=0; $n<$total_items; $n++) { if($n !=0 && fmod($n, 5) == 0) { echo "</tr><tr>"; } $imageL= $path.$item[$n]; $img_path="http://ve-creative.com/test/8/$imageL"; // display the item echo '<td><center><p><a href="'.$img_path .'"><img src= "'.$path.$item[$n] .'" height="100" width="100"></a></p></center>'; echo "<center><p><a href=imgEdit.php?img=$img_path> > Edit Image < </a></p></center><br></td>"; } if($r>0) { for($m=$r; $m<5; $m++) { echo "<td> </td>"; } } ?>
-
it luks lyk im gonna have to use the resize on upload. that last link you sent wasn't to helpful....how can i change this upload code to include the resizing? <? while(list($key,$value) = each($_FILES['images']['name'])) { if(!empty($value)) { $filename = $value; $filename=str_replace(" ","_",$filename);// Add _ inplace of blank space in file name, you can remove this line $add = "upload/imgtemp/m/$random_digit/$filename"; $tempFLDR = "upload/imgtemp/t/$random_digit/$filename"; //echo $_FILES['images']['type'][$key]; // echo "<br>"; copy($_FILES['images']['tmp_name'][$key], $add); chmod("$add",0777); copy($_FILES['images']['tmp_name'][$key], $tempFLDR); chmod("$tempFLDR",0777); $folderPath="upload/$random_digit/"; } } ?>
-
thanks red arrow
-
i've seen a lot of PHP GD examples......hmmm.....ill try but im after something simpler...GD is too much to tae in right now lol thanks for the example i will try it out
-
will this work if i take out the thumbnails as its not needed?
-
im a php noob so can you give me an example of how its done and i can work my way from there?
-
can this replace the original file?
-
is it possible to get a image that has already been uploaded resized?
-
thanks red arrow but i just want to name the pictures with numbers i.e. 1.jpg 2.jpg 3.jpg 4.jpg 5.jpg etc etc it saves me having to recode my flash gallery
-
i have tried it seperately from my main code and it works......but trying to incorporate it into my main code i cant figure out. here is the coding.....can someone point me in the right direction.....thanks again for the help before and for this in advance <? while(list($key,$value) = each($_FILES['images']['name'])) { if(!empty($value)) { $filename = $value; $filename=str_replace(" ","_",$filename);// Add _ inplace of blank space in file name, you can remove this line $add = "upload/$random_digit/$filename"; $tempFLDR = "upload/imgtemp/$filename"; //echo $_FILES['images']['type'][$key]; // echo "<br>"; copy($_FILES['images']['tmp_name'][$key], $add); chmod("$add",0777); copy($_FILES['images']['tmp_name'][$key], $tempFLDR); chmod("$tempFLDR",0777); $count = 1; foreach(glob('*.jpg') as $filename) { copy($filename, $count.substr($filename, -4)); $count++; } $folderPath="upload/$random_digit/"; } } ?>
-
thanks thats great......lol you guessed it straight away. thanks again everyone
-
noob question. how can i start with the number 1 and then get php to add 1 for each image name? so i start wit 1.jpg and php adds 1 to get 2.jpg and then the same for the rest....i really am a noob wit php
-
[SOLVED] upload, duplicate, resize and rename
anf.etienne replied to anf.etienne's topic in PHP Coding Help
the script doesn't do as it should....it doesn't do anything -
[SOLVED] upload, duplicate, resize and rename
anf.etienne replied to anf.etienne's topic in PHP Coding Help
to make the thumbnails it helps alot but i need it to rename accordingly like below......can this be done? 1.jpg 1b.jpg 2.jpg 2b.jpg 3.jpg 3b.jpg etc etc -
is it possible to upload images and have them duplicated, renamed then resized? the names would be like below. 1 1b 2 2b 3 3b 4 4b etc etc
-
[SOLVED] diplay images in directory....URGENT!
anf.etienne replied to anf.etienne's topic in PHP Coding Help
im a noob to php i got this code through doing a tutorial....i have figured a way to deal with the issue but i am trying to get it into rows....thank you for your help -
[SOLVED] diplay images in directory....URGENT!
anf.etienne replied to anf.etienne's topic in PHP Coding Help
<?php require_once 'js/iframeRS.js'; for($i=0; $i<5; $i++){ if($i != 0){ $start = $start + $max_items; $end = $end + $max_items; } echo "<td>"; ?> i take it ill be replacing this part of the coding? -
[SOLVED] diplay images in directory....URGENT!
anf.etienne replied to anf.etienne's topic in PHP Coding Help
if i upload 6 i want it to display all.....5 images on the 1st row then start a new row for the 6th image. -
i have this coding that uploads files and then displays the images within the directory created.....the problem i have is if i upload say 6 images it displays them over 3 columns instead of the full 5 columns set. On top of this it also displays placeholders where there should be a blank space if you go to http://ve-creative.com/test/8/templateEdit2.php and upload 2 images you can see what i mean. the code to view the images is below <?php $folderPath= $id; $full_path=$fileL; $path = "$folderPath"; // path to the directory to read ( ./ reads the dir this file is in) if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if(!is_dir($file)){ $item[] = $file; } } } closedir($handle); } $total_items = count($item); $max_items = ceil($total_items / 5); // items per <td> $start = 0; $end = $max_items //generate the table ?> <center> <table width="650px" border="1" cellspacing="5" cellpadding="5" align="center"> <tr> <?php require_once 'js/iframeRS.js'; for($i=0; $i<5; $i++){ if($i != 0){ $start = $start + $max_items; $end = $end + $max_items; } echo "<td>"; for($x = $start; $x < $end; $x++){ $imageL= $path.$item[$x]; $img_path="http://ve-creative.com/test/8/$imageL"; // display the item echo '<center><p><img src= "'.$path.$item[$x] .'" height="100" width="100"></p></center>'; echo "<input type=CHECKBOX name=$imageL>"; echo "<a href=imgEdit.php?img=$img_path>[Edit / resize]</a><br>"; } echo "</td>"; } ?> </tr> </table>
-
hi i have this php script that generates a link that uses javascript to load a page into a iframe. <?php require_once 'js/iframeRS.js'; for($i=0; $i<5; $i++){ if($i != 0){ $start = $start + $max_items; $end = $end + $max_items; } echo "<td>"; for($x = $start; $x < $end; $x++){ $imageL= $path.$item[$x]; $img_path="http://ve-creative.com/test/8/$imageL"; // display the item echo '<center><p><img src= "'.$path.$item[$x] .'" height="100" width="100"></p></center>'; echo "<script type='text/Javascript'>loadintoIframe(iframeresize, imgEdit.php?img=$img_path)[Edit / resize]<br></script>"; } echo "</td>"; } ?> my main focus is on this part below; i want it to show "[Edit / resize]" as a link that opens "imgEdit.php?img=$img_path" in the iframe. but i can't get it to generate the link. echo "<script type='text/Javascript'>loadintoIframe(iframeresize, imgEdit.php?img=$img_path)[Edit / resize]<br></script>"; can someone point me in the right direction....thanks in advance
-
hi, the code below that you told me to try does not generate the link that i need it to. echo "<script type='text/Javascript'>loadintoIframe(iframeresize, imgEdit.php?img=$img_path)[Edit / resize]</script><br>";
-
lol thats fine....it isn't the javascript thats the problem i just don't know much about mixing php & javascript but im learning lol thanks again
-
thnaks i shall give this a try
-
ok it shows the full link but i dont think that the php is recognising the javascript that is in the link.....is there anyway to get it to recognise the function so it calls the javascript this is the javascript im trying to call <script type="text/javascript"> //Input the IDs of the IFRAMES you wish to dynamically resize to match its content height: //Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none: var iframeids=["iframeresize"] //Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended): var iframehide="yes" var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1] var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers function resizeCaller() { var dyniframe=new Array() for (i=0; i<iframeids.length; i++){ if (document.getElementById) resizeIframe(iframeids[i]) //reveal iframe for lower end browsers? (see var above): if ((document.all || document.getElementById) && iframehide=="no"){ var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i]) tempobj.style.display="block" } } } function resizeIframe(frameid){ var currentfr=document.getElementById(frameid) if (currentfr && !window.opera){ currentfr.style.display="block" if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax currentfr.height = currentfr.Document.body.scrollHeight; if (currentfr.addEventListener) currentfr.addEventListener("load", readjustIframe, false) else if (currentfr.attachEvent){ currentfr.detachEvent("onload", readjustIframe) // Bug fix line currentfr.attachEvent("onload", readjustIframe) } } } function readjustIframe(loadevt) { var crossevt=(window.event)? event : loadevt var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement if (iframeroot) resizeIframe(iframeroot.id); } function loadintoIframe(iframeid, url){ if (document.getElementById) document.getElementById(iframeid).src=url } if (window.addEventListener) window.addEventListener("load", resizeCaller, false) else if (window.attachEvent) window.attachEvent("onload", resizeCaller) else window.onload=resizeCaller </script>
-
i was just testing so many different things to see what works....thanks i will give that a shot