emediastudios Posted October 24, 2007 Share Posted October 24, 2007 Hi everyone, im using the code i found on the web call dynamic image viewer. It works great and displays files in my images folder, what i want is to alter the code to resize the images to a fixed size. Heres all the codes <style type="text/css"> #picturearea{ filter:alpha(opacity=100); -moz-opacity: 0; } </style> <!-- Change path below to point to "getpics.php" on your server --> <script src="getpics.php" type="text/javascript"></script> <script type="text/javascript"> <!-- Dynamic PHP Picture Viewer (v1.0)- By JavaScriptKit.com (http://www.javascriptkit.com) //---> <!-- For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/ //---> <!-- This notice must stay intact for use //---> function populateSelect(selectobj){ for (var i=0; i<picsarray.length; i++) selectobj.options[selectobj.options.length]=new Option(picsarray[i], picsarray[i]) if (selectobj.options.length>1){ selectobj.selectedIndex=0 showpicture(document.getElementById("picsform").picslist) } } function showpicture(selectobj){ piccontainerobj=document.getElementById("picturearea") resetfade(10) piccontainerobj.innerHTML='<img src="'+locationstring+selectobj.options[selectobj.selectedIndex].value+'">' fadepictoview=setInterval("gradualfade(piccontainerobj)",50) } function resetfade(degree){ if (window.fadepictoview) clearInterval(fadepictoview) if (typeof piccontainerobj.style.MozOpacity=="string") piccontainerobj.style.MozOpacity=degree/100 else if (piccontainerobj.filters) piccontainerobj.filters.alpha.opacity=degree } function gradualfade(){ if (typeof piccontainerobj.style.MozOpacity=="string" && piccontainerobj.style.MozOpacity<1) piccontainerobj.style.MozOpacity=Math.min(parseFloat(piccontainerobj.style.MozOpacity)+0.2, 0.99) else if (piccontainerobj.filters && piccontainerobj.filters.alpha.opacity<100) piccontainerobj.filters.alpha.opacity+=20 else //if not IE or Moz clearInterval(fadepictoview) } window.onload=function(){ populateSelect(document.getElementById("picsform").picslist) } </script> Code 2 <div style="float: left; width: 200px;"> <form id="picsform"> <select name="picslist" size="4" style="width: 200px" onClick="showpicture(this)"> </select> </form> </div> <div id="picturearea" style="float: left; width: 400px; height: 300px; margin-left: 20px"> </div> <br style="clear: left" /> <p style="font: normal 11px Arial">This free script provided by<br /> <a href="http://www.javascriptkit.com">JavaScript Kit</a></p> Code 3 <? Header("content-type: application/x-javascript"); $pathstring=pathinfo($_SERVER['PHP_SELF']); $locationstring="http://" . $_SERVER['HTTP_HOST'].$pathstring['dirname'] . "/"; function returnimages($dirname=".") { $pattern="(\.jpg$)|(\.png$)|(\.jpeg$)|(\.gif$)"; $files = array(); $curimage=0; if($handle = opendir($dirname)) { while(false !== ($file = readdir($handle))){ if(eregi($pattern, $file)){ echo 'picsarray[' . $curimage .']="' . $file . '";'; $curimage++; } } closedir($handle); } return($files); } echo 'var locationstring="' . $locationstring . '";'; echo 'var picsarray=new Array();'; returnimages() ?> Quote Link to comment https://forums.phpfreaks.com/topic/74587-image-resize/ Share on other sites More sharing options...
emediastudios Posted October 25, 2007 Author Share Posted October 25, 2007 ANYONE HELP ME PLEASE ??? Quote Link to comment https://forums.phpfreaks.com/topic/74587-image-resize/#findComment-377622 Share on other sites More sharing options...
jellis Posted October 25, 2007 Share Posted October 25, 2007 Seriously mate... just google it. Do you need someone to spread your butt-cheeks and wipe your ass for you as well? Alternatively, you could use the SEARCH function as the same question has been asked a million times previously. Quote Link to comment https://forums.phpfreaks.com/topic/74587-image-resize/#findComment-377658 Share on other sites More sharing options...
emediastudios Posted October 25, 2007 Author Share Posted October 25, 2007 no need to be like that you angry piece of shit. I have googled, i am still lerning thats why i need help. Quote Link to comment https://forums.phpfreaks.com/topic/74587-image-resize/#findComment-377713 Share on other sites More sharing options...
jellis Posted October 25, 2007 Share Posted October 25, 2007 Gee... I'm sorry. I didn't mean to step on your precious tootsies. 2.5 mins of searching came up with this... http://tech.mikelopez.info/2006/03/02/php-image-resize-script/ Read the instructions therein... and then try to figure out for yourself how to implement it. A brief look through the code tells me it's exactly what you're after. How you implement it is entirely up to you. HINT: The image will be called through the URL to resize it... get my drift? Quote Link to comment https://forums.phpfreaks.com/topic/74587-image-resize/#findComment-377744 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.