Jump to content

bbunlock

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Everything posted by bbunlock

  1. thanks for the help guys, love this place wayne
  2. I know this is simple but for the life of me I cannot remember how it is done and cant find it anywhere, ive even gone throught loads of my scripts to see an example but cant find it ok I want to update a $value to include more info, for exxample $value = "value1" then alter in the code I want to be able to add to this like so $value = $value + " - value2" $value = $value + " - value3" and when I do an "echo $value" it would show value1 - value2 - value3 etc can anyone tell me how this is done, I have seen it done before but cannot for the life of me find it and I have no idea what I would even search for any help is much appriciated regards wayne
  3. Just wanted to say a big thanks to AbraCadaver for the code provided above, I now have everything work great using your code as a guide thanks you very much regards wayne
  4. Hi and thanks for taking the time to read this and to help if you can I have a flex app that is sending data to a php script that will then perform tasks based on the data found inthe array, my problem is that there are over 270 items in the array and I need to alter many of them BEFORE the script performs its task, what I need is a way to alter the data in the array without having to do it one at a time which I will have to do, below is some exxamples of what I am looking to do for example the array will have data on aprox 35 colors and I need to check and these values and change them if needed, my current system is as follows $color1 = $skin['color1']; if (preg_match("/0x/i", $color1)) { $color1 = str_replace("0x", "", $color1); } else { $color1 = str_pad(dechex($color1), 6, '0', STR_PAD_LEFT); } if($color1=="" || $color1=="000000"){$color1="100000";} now currently I would have to do this individualy for $skin['color1'], $skin['color2'], $skin['color3'] etc etc so is there a way I can do it without such bloated code, for example a while or a foreach statement etc? im not great at php so I am not sure how I would go about this if its possible another thing is that the rest of the values in the array are for image values and I need to fillter through them to find out which are the default images and which are not (no tasks are performed on default images) the following are example values from the array for the arrar item $clockface = $skin['clockface'] /home/thesite/public_html/flex_app/assets/default/clockface.png /home/thesite/public_html/flex_app/gallery/clock/clockface_3.png /home/thesite/public_html/flex_app/uploads/uploaded_file.jpg now depending on the value of the array I would wat the following for the 3 values above $clockface = ""; // if its the first value $clockface = "/home/thesite/public_html/flex_app/gallery/clock/pack3/clockface.svg" // if its the second value $clockface = "/home/thesite/public_html/flex_app/uploads/uploaded_file.jpg" // if its the third value now the above is easy to do on an individual basis but I want to streamline my code and not have an if statement with str_replace etc for each and every value which means I would have to do the code over 200 times for the images now as you can see from the first set of values there are certain things that give clues as to what and where the image is ("assests/default", "gallery/clock/clockface_3.png" and "uploads/uploaded_file.jpg") and I would use these to produce the final values above but again I would have to do it on an individual basis for each array value so is there any way I can streamline the process with again a while or a foreach statement or another way of doing this? your help is very much appriciated regards wayne
  5. thanks PFMaBiSmAd you cracked it :-) I had looked at the phpinfo data hours ago to see if the changes in the local php.ini had been made and they were, I never thought to look and see if other things had changed, I added a few lines more to the local php.ini file that were different with and without the php.ini and now all works great :-) not sure if ringtones are your thing but you might like to see it in action, http://www.ringbuz.com totaly free to use so dont panic you wont need to register or anything once again PFMaBiSmAd thanks for the help on this regards wayne
  6. Hi PFMaBiSmAd thanks for the reply first I have to say there is nothing wrong with the flash app if there is no php.ini in the domain root, here is an example of what happens with large files 1, add the php.ini to the domain root with the values listed above 2, upload an mp3 (example 5M) 3, upload completes and now transfered to the flash app for editing 4, press play and nothing is heard (doesnt play the uploaded mp3) 5, now I goto the domain root and delete the php.ini file 6, go back to web page and refresh the the page loading the flash app again 7, press play and all works fine with no php.ini I did my normal thing and tried to narrow down the problem with the php.ini by removing a line at a time and see if the ap works, the strange thing is that it doesnt matter whats in the php.ini, for example I uploaded an empty php.ini (0 bytes) and it didnt play the file, so basicaly any php.ini file with content or empty prevents the flash app from playing the mp3. Now my guess would be that the php.ini may need other param in it to work correctly? as I mentioned above it only has those 5 lines in it so I dont know if php.ini needs any special open/close params for it to work correctly, as in a .htaccess file the params above would be <IfModule mod_php4.c> php_value max_execution_time 60 php_value max_input_time 120 php_value memory_limit 128M php_value post_max_size 14M php_value upload_max_filesize 10M </IfModule> which means you need the <IfModule mod_phpxxx> for it to work in htaccess, is there somthing that php.ini needs for it to work correctly? regards wayne
  7. I have a ringtone creator site where people can upload music files and select sections to make into a ringtone, I have for the last year been using a cgi upload script becuase it can handle 32M out of the box where php can only handle 2M now I have changed the cgi upload to a flash upload but have had problems with it, the flash app usues php to move the upload file to the folder I want to store the uploaded files in so im kinda back to sqaure one with the 2mb limit. I could change the php.ini/httpd.conf file(s) to change the 2M limit but this is a shared server so didnt want to go that route so decided to try and change the limit via .htaccess but that didnt work, php is a cgi module not a apache module so php_value in htaccess has no effect when in cgi mode. I have tried adding a php.ini with the following params to the doomains root and that works great for uploading the files. max_execution_time = 60 max_input_time = 120 memory_limit = 128M post_max_size = 12M upload_max_filesize = 10M however even though that allows me to upload large files upto 12M it actualy breaks the flash application that loads and plays the uploaded mp3, for example I upload test.mp3 of 5M and it uploads perfectly to the server (with the php.ini listed above) but the flash app will not play the mp3 file? if I delete the php.ini from the root and refresh the page it works great? so basicaly the php.ini allows me to upload large files but breaks the flash app, but without the php.ini it wont upload files over 2mb, well thats not true it actualy uploads the file no problem but the flash ap then calls upload.php to move it from the servers default tmp folder to the folder where the files are stored for the flash editor and then tells me in my error_log the file was over 2M and was not saved. Now I have used .htaccess lots of times for mod rewite etc but this is the first time I have used a php.ini instead of a htaccess file, so is there somthing I need to add to my php.ini file to solve this? please be aware that the code I listed above as to what is in my php.ini file is exactly whats in it, there are no other lines of code in the file just the 5 lines listed above. hope someone can shed some light on this for me regards wayne
  8. wow cant believe it but actualy got it working, well to be honest I found a code example on php.net for readdir and managd to tweek it a couple of places and now works great thanks all the same regards wayne
  9. First of thanks for taking the time to read this and help if possible. I have a script that allows me to import data into the database, it works great for the current system setup but I have just changed it and can not figure out how to alter the script to apply the new changes to the system. the current system works like this, I upload a number of theme files (example.sis) and a screenshot of each theme file (example.jpg), now the screenshot file needs to be named exactly the same as the theme file but of course different extension, example "Blue_Theme.sis" "Blue_Theme.jpg" and the script works great. However here is my problem, the new system uses 2 screenshot files for the the themes and they are named like this "Blue_Theme.sis" "Blue_Theme-1.jpg" "Blue_Theme-2.jpg" and I cant figure out what to do on the current script to make it work with the 2 screenshot files named a little differently. I will paste the original code (before I changed it 100 times trying to get it working) for you to have a look at and hopefully get it working with the new system <? require ('inc_auth.php'); include ('functions.php'); include ('lib/lib_image.php'); $link = 10; if (isset($_POST['directory']) && count($_POST) == 1){ $directory = trim($_POST['directory']); if (is_dir($directory)) { if ($dh = opendir($directory)) { while (($file = readdir($dh)) !== false) { $arr[] = $file; } closedir($dh); foreach ($arr as $v){ preg_match("~^(.+?)\.(\w{3,4})~is", $v, $m); if (!in_array($m[1], $fileArr) && $m[1] != null) $fileArr[] = $m[1]; } } } } if (isset($_POST['dir'])){ $directory = trim($_POST['dir']); if (is_dir($directory)) { if ($dh = opendir($directory)) { while (($file = readdir($dh)) !== false) { $arr[] = $file; } closedir($dh); foreach ($arr as $v){ preg_match("~^(.+?)\.(\w{3,4})~is", $v, $m); if ($m[1] != null){ if ($m[2] == "sis") $fileArr[$m[1]]["sis"] = $v; else $fileArr[$m[1]]["image"] = $v; } } $category_id = (int)$_POST['category']; $model = (int)$_POST['model']; $thm_type_id = (int)$_POST['thm_type']; $r = $sql->load_obj("SELECT id FROM mobiles WHERE thm_type={$thm_type_id} LIMIT 1"); $mobile_id = $r->id; $r = $sql->load_obj("SELECT * FROM thm_types WHERE id={$thm_type_id}"); $thm_type = $r->type; $r = $sql->load_obj("SELECT * FROM categories WHERE id={$category_id}"); $category = $r->name; $files = $_POST['f']; foreach ($files as $v=>$value){ if (isset($fileArr[$v]['image']) && isset($fileArr[$v]['sis'])){ $sql->insert("files", array( 'name' => $fileArr[$v]['sis'], 'file_type' => "theme", 'user_id' => 1, 'category_id' => $category_id, 'upl_date' => date("Y-m-d H:i:s"), 'active' => 1, 'mobile_id' => $mobile_id)); $id = $sql->last_id(); $sql->insert("ratings", array( 'id' => $id, 'total_value' => 0, 'total_votes' => 0, 'used_ips' => 0)); $sys_file_dest = "{$id}.sis"; $thumb_file = "{$id}_thumb.jpg"; $dest_file = "{$id}.jpg"; copy("{$directory}/{$fileArr[$v]['image']}", "{$themesDir}/".folderName($thm_type)."/".folderName($category)."/{$dest_file}"); $thumb = imageCreateResized("{$directory}/{$fileArr[$v]['image']}", $themeThumbWidth); imagejpeg($thumb, "{$themesDir}/".folderName($thm_type)."/".folderName($category)."/{$thumb_file}"); copy("{$directory}/{$fileArr[$v]['sis']}", "{$themesDir}/".folderName($thm_type)."/".folderName($category)."/{$sys_file_dest}"); unlink("{$directory}/{$fileArr[$v]['image']}"); unlink("{$directory}/{$fileArr[$v]['sis']}"); $savedFiles[] = "{$directory}/{$fileArr[$v]['image']} - {$directory}/{$fileArr[$v]['sis']}"; echo $sql->error(); } } $auth->redirect("import.php?count=".count($savedFiles)); } } } ?> <HTML> <HEAD> <TITLE>Import themes</TITLE> <link rel="stylesheet" href="style.css" type="text/css"> </HEAD> <BODY> <? include ('admin/left_menu.php'); ?> <DIV style="float: left"> <h3>Import themes</h3> <form method='POST' action=''> <table class='design' cellspacing="0" width=400> <? if (count($_POST) == 0 && count($_GET) == 0){ ?> <tr> <td colspan="2"> <label for='directory'>Directory</label> public_html/<input type='text' name='directory' id='directory'> </td> </tr> <tr> <td colspan="2" align="right"><input type='submit' value='Submit' class='button'></td> </tr> <? }elseif (isset($_POST['directory'])) {?> <tr> <td> <label for='category'>Category</label> <select id='category' name="category" style="width: 140px"> <? $sql->query("SELECT * FROM categories WHERE type='Theme' ORDER BY name"); while($r = $sql->obj()){ echo "<option value='{$r->id}'>{$r->name}</option>"; } ?> </select> </td> </tr> <tr> <td> <label for='thm_type'>Type</label> <select name='thm_type' id='thm_type' style="width: 140px"> <? $sql->query("SELECT * FROM thm_types ORDER BY type"); while ($r = $sql->obj()){ echo "<option value='{$r->id}'>{$r->type}</option>"; } ?> </select> </td> </tr> <? foreach ($fileArr as $k=>$v){ echo "<tr><td colspan='2'><input type='checkbox' value='1' checked name='f[".htmlspecialchars($v)."]}'>".htmlspecialchars($v)."</td></tr>"; } ?> <input type='hidden' name='dir' value='<?=$_POST['directory']?>'> <tr> <td align="right"><input type='submit' value='Submit' class='button'></td> </tr> <?} elseif(isset($_GET['count'])){?> <tr> <td> <? echo (int)$_GET['count']." themes have been saved"; ?> </td> </tr> <?}?> </table> </form> </DIV> </BODY> </HTML> thanks in advance wayne
  10. @php.ajax.coder thanks for the info, I was going to ask how to add the paramaters to that but did a little searching and found a few examples so managed to get it working great, even found out how to make it load the theme value when page is loaded. thanks for the help regards wayne
  11. I have come accross a script suplied at w3schools (http://www.w3schools.com/PHP/php_ajax_database.asp) however I would like your help in modifying it to serve my purpose, below are the modifications I would like help with. 1, I would like to use standard links instead of a drop down form, so when a link is clicked it shows the results. 2, instead of sending just one paramater to the javascript code (value="?") I would like to send 2 paramaters in the link ("uid" and "up_type") 3, I would like it to display the first link details when page loads (so dont have to click a link to activate it on loadup) so by default the first link would be loaded on page load. If this was a standard link it would be somthing like the following "usrup.php?uid=some_id&up_type=some_type" its the "uid" and "up_type" that I need sent to the javascript code, the form only allows value="?" I need 2 paramaters sent. Unfortunately I have very little to no experience with javascript and ajax so your help would be greatly appriciated on this. There is no point me pasting the code for the form itself as im not looking to use a form/dropdown box but I will paste the javascript code used at w3schools. Javascript var xmlHttp function showUser(str) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="getuser.php" url=url+"?q="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } could someone please help me change this so that I can click a link instead of a form and the link supplies 2 paramaters to the javascript code instead of just the 1 thank you very much for your help regards wayne
  12. I have found another script that is almost what I want but needs some additions done to it, I will post this as a new topic instead of posting to this one. regards wayne
  13. Hi and first thanks for reading Ok I have a little ajax script that allows me to display content in divs, the content is like layers that are shown/hidden depending on the link clicked. the only problem with the script is that it loads all the divs at once, what I would like is that the content for each div is loaded when the link is clicked. below is the code im curently using javascript // CSS helper functions CSS = { // Adds a class to an element. AddClass: function (e, c) { if (!e.className.match(new RegExp("\\b" + c + "\\b", "i"))) e.className += (e.className ? " " : "") + c; }, // Removes a class from an element. RemoveClass: function (e, c) { e.className = e.className.replace(new RegExp(" \\b" + c + "\\b|\\b" + c + "\\b ?", "gi"), ""); } }; // Functions for handling tabs. Tabs = { // Changes to the tab with the specified ID. GoTo: function (contentId, skipReplace) { // This variable will be true if a tab for the specified // content ID was found. var foundTab = false; // Get the TOC element. var toc = document.getElementById("toc"); if (toc) { var lis = toc.getElementsByTagName("li"); for (var j = 0; j < lis.length; j++) { var li = lis[j]; // Give the current tab link the class "current" and // remove the class from any other TOC links. var anchors = li.getElementsByTagName("a"); for (var k = 0; k < anchors.length; k++) { if (anchors[k].hash == "#" + contentId) { CSS.AddClass(li, "current"); foundTab = true; break; } else { CSS.RemoveClass(li, "current"); } } } } // Show the content with the specified ID. var divsToHide = []; var divs = document.getElementsByTagName("div"); for (var i = 0; i < divs.length; i++) { var div = divs[i]; if (div.className.match(/\bcontent\b/i)) { if (div.id == "_" + contentId) div.style.display = "block"; else divsToHide.push(div); } } // Hide the other content boxes. for (var i = 0; i < divsToHide.length; i++) divsToHide[i].style.display = "none"; // Change the address bar. if (!skipReplace) window.location.replace("#" + contentId); }, OnClickHandler: function (e) { // Stop the event (to stop it from scrolling or // making an entry in the history). if (!e) e = window.event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; // Get the name of the anchor of the link that was clicked. Tabs.GoTo(this.hash.substring(1)); }, Init: function () { if (!document.getElementsByTagName) return; // Attach an onclick event to all the anchor links on the page. var anchors = document.getElementsByTagName("a"); for (var i = 0; i < anchors.length; i++) { var a = anchors[i]; if (a.hash) a.onclick = Tabs.OnClickHandler; } var contentId; if (window.location.hash) contentId = window.location.hash.substring(1); var divs = document.getElementsByTagName("div"); for (var i = 0; i < divs.length; i++) { var div = divs[i]; if (div.className.match(/\bcontent\b/i)) { if (!contentId) contentId = div.id; div.id = "_" + div.id; } } if (contentId) Tabs.GoTo(contentId, true); } }; // Hook up the OnLoad event to the tab initialization function. window.onload = Tabs.Init; // Hide the content while waiting for the onload event to trigger. var contentId = window.location.hash || "#Introduction"; if (document.createStyleSheet) { var style = document.createStyleSheet(); style.addRule("div.content", "display: none;"); style.addRule("div" + contentId, "display: block;"); } else { var head = document.getElementsByTagName("head")[0]; if (head) { var style = document.createElement("style"); style.setAttribute("type", "text/css"); style.appendChild(document.createTextNode("div.content { display: none; }")); style.appendChild(document.createTextNode("div" + contentId + " { display: block; }")); head.appendChild(style); } } Html <!-- start of tabbed options menu --> <ol id="toc"> <li><a href="#Themes">Themes</a></li> <li><a href="#Ringtones">Ringtones</a></li> <li><a href="#Wallpapers">Wallpapers</a></li> </ol> <!-- start of Themes section --> <div class="tab-content" id="Themes"> Do mysql query for themes do the php code to display the themes found in mysql query </div> <!-- start of Ringtones section --> <div class="tab-content" id="Ringtones"> Do mysql query for ringtones do the php code to display the ringtones found in mysql query </div> <!-- start of Wallpapers section --> <div class="tab-content" id="Wallpapers"> Do mysql query for wallpapers do the php code to display the wallpapers found in mysql query </div> Could anyone help me out here please, I have no knowledge of ajax at all. regards wayne
  14. is ther any chance you can get the topic solved button to be more visible? I always go for the topic solved when my question has been solved and I have to say I always find it hard to find (no pun intended) I would highly recomend making it more visible as it is far to easy to miss, otherwise a great feature on a great forum. regards wayne
  15. thank you very much taith for that, works great now very much appriciated regards wayne
  16. I have a pagination function that I use and im currently re-designing my site and im using "xampp" on my windows pc to do all the work and testing localy instead of on an actual server So far I have only come acrosss 1 error and thats with the pagination function, the xampp installed on my pc is using php 5 where my server is using pho 4, it works fine on 4 but not on 5. the full error message is "Fatal error: Using $this when not in object context in C:\xampp\htdocs\cellmind\functions.php on line 314" and the code for the function is as follows function specs_num($params, $itemFound, $imagesPerPage, $pg) { $ntotal = $itemFound; $page_max = $imagesPerPage; $tp = 1 + (int)(($ntotal - 1) / $page_max); $page_ncur = 5; $page_nlim = 2; $numofpages = ceil($ntotal / $page_max); if ($tp < 2) return; echo "<div class='pages_num' align=center>"; $j = $pg - 1; echo "<span class='total_pages'>$numofpages Pages</span> "; if($pg==1); else{ echo "<A href='{$params}".($pg != 1 ? $pg - 1 : $pg),"/'>Prev</A> "; } $i = max($pg - ($page_ncur - 1), 1); $p = min($pg + ($page_ncur - 1), $tp); for ($j = 1; $j <= $page_nlim && $j < $i; $j++) echo ($pg != $j ? "<A href='{$params}{$j}/'>{$j}</A> " : "<B>{$j}</B> "); if ($i > $page_nlim) echo ".. "; for (; $i <= $p; $i++) echo ($pg != $i ? "<A href='{$params}{$i}/'>{$i}</A> " : "<B>{$i}</B> "); if ($tp - $this->page_nlim > $p) echo ".. "; for ($j = max($p, $tp - $this->page_nlim) + 1; $j <= $tp; $j++) echo ($pg != $j ? "<A href='{$params}{$j}/'>{$j}</A> " : "<B>{$j}</B> "); echo "</SPAN>"; $j = $pg + 1; if($pg==$numofpages); else{ echo "<A href='{$params}".($pg != ceil($itemFound/$imagesPerPage) ? $pg + 1 : $pg)."/'>Next</A>"; } echo "</div>"; } I could still get this working ok by just uploading the files to the actual server for testing but that isnt going to help me when the server actualy goes to php 5. I know very little about php and can get away with using it in a limited way but this is just beyond me, I have no idea whats wrong and how to solve this so if anyone can help me out that would be great. thanks for your time and help regards wayne
  17. thank you both for the help, its now working great much appriciated wayne
  18. I have a flex app that was made for me that sends the values via the post method, the problem is that the color values are sent in decimal format. I have used the dec2hex function and it works on some of them but it fails on others, for example the post data might send "16763955" which I can convert using the dechex function into its correct hex color code example "00ff00" BUT some of the decimal values are for example "65535" which converts to "33cc" which is no good becuase the correct value is "0033cc" it apears that dechex will not convert these correctly. is there another function that I have missed that will convert them to the correct hex code? I have sent the flex developer an email a couple of days ago but heard nothing back so diceded to try a php convert instead but having problems as described above. if anyone can suggest another method to get the correct values then please reply to let me know thanks in advance wayne
  19. Thanks aCa that worked great, and nice tool by the way regards wayne
  20. I have never needed to use anything like this (finding a string of text) so I have no idea how to do this, I did try going to php.net and looking there and on here but its all just going over my head, I have no doubt this is going to be childs play for one of you guys/gals but my head is now numb with this. can anyone tell me how I would get the following details for this string of text (sent by $_POST) this is an example of what the $_POST woiuld contain http://www.mysite.co.uk/tc_test/_resources/signals/s60-3/indi2/sig2.png and what im looking to extract from it is the "indi2" however the "indi2" could change depending on what was sent, it could be "indi3, indi4, etc" but it will always be indi followed by a number(s) if anyone could help me out that would be great. thanks in advance wayne
  21. a big thank you rhodesa that worked perfectly once again thank you very much regards wayne
  22. Hi there im hoping someone can help me with this little problem, im running an exec() command but it is failing becuase the command is not being run in the folder that stores the files, this is how I have things set I have a folder called create in which I have my php scripts (the one that calls the exec command), in that folder I have another folder called create_temp, the create_temp folder has the command files in it and also the files to process. if I was in the create_temp folder and ran the exec command all works fine, but becuase im in the create folder it fails becase one of the files the command files processes is looking for the files in the create folder. so basicaly im running the exec command like the following system_command is the system command that exec is executing created.mif is the file that will be created when the exec command is run created_List.txt is the file system_command reads from now the problem is that the created_List.txt file has lines like the following in it. .\ means current folder, but in this case its thinking the files are in the create folder becuase that is the folder the exec is being run from and if I change the lines in created_List.txt to the following it would work but the only problem is that created_List.txt is created from a previous exec command and isnt a static file so the way I see it I have 2 choices. 1, find a way to run the exec command and the system tool thinks its in the correct folder 2, after the created_List.txt is created on a previous exec command open it up via a php method and change all instances of ".\" to ".\create_temp\" one thing to note is that the system has "phpsuexec" running which means my php scripts cannot be run from a 777 folder and cannot have the 777 permission themselves if anyone has any suggestions on how to solve this I would be very greatfull regards wayne
  23. @ Fyorl thats exactly what I was looking for, added that little extra code to both of the functions above and it now doesnt look into those fodlers. thanks you all very much for the help
  24. yes I realy need both scripts to work, now as it is at the moment both scripts start at the albums folder and read what is in that folder, now there will be no images in the album folder only other folder (each folder represents an album) so for example the album folder may have albums/album1 albums/album2 albums/album3 albums/album4 etc now when the gallery script is run it sees these album folders and creates links to them, below is a link to show what I mean [a href=\"http://www.sitebuz.com/memsites/tester/gallery/index.php\" target=\"_blank\"]http://www.sitebuz.com/memsites/tester/gallery/index.php[/a] now when you click on an album from the link above (only album1 has images in it at the moment) the gallery script creates thumbnails for the images in there and shows them as it should do. now the other script also has access to the albums folder and shows links to the albums in it (album1, album2 etc), now when this script access a album folder it creates at least 1 folder called .thumbs and if the images are resized using this script it also creates a folder called .resized. now the problem is that the gallery script will look into album1 and show the thumbnails but it also see's .thumbs and .resized as sub albums and shows a link to them, these are not new albums but woking folders for the second script, see link below for example [a href=\"http://www.sitebuz.com/memsites/tester/gallery/index.php?album=album1&sortby=name&order=asc\" target=\"_blank\"]http://www.sitebuz.com/memsites/tester/gal...=name&order=asc[/a] now as you can see from the second link it shows the .thumbs folder at the top as a sub album, I want the gallery script to not create a link for any folder it see's starting with .thumbs or .resized. thanks in advance
  25. Hi peeps thanks for taking the time to read this. ok I have a small gallery script that reads the contents of a given folder eg albums/album1 and displays thumbnails of the images in the folder, now all that works great but I also have another script that uses the album1 folder, now if this script acccesses the album1 folder it will create a thumbnail folder called .thumbs and another folder called .resized. so for example the gallery script will look into album1 and it automaticaly creates its own thumbnails and shows the images in that folder, however the other script that accesses the album1 folder creates .thumbs and .resized folders in there, now what I want is for the gallery script [b]NOT[/b] to look into these 2 .folders? below is what I believe to be the parts of the gallery script that looks and reads the folders so if somone can tell me what to add to them to not have the gallery script look at .thumbs and .resized that would be great. the function would be called witht he following code [code]$contents = dir_get_contents ( $conf_root . 'albums/', $album );[/code] and the function(s) that relate tot his are I believe [code]function dir_get_contents ( $root, $dir ) {     $dir = $dir != '' && $dir != '/' ? trim ( $dir, '/' ) : '';     $path = $root . $dir . '/';     $h = opendir ( $path );     if ( !$h )     {         exit ( 'Unable to open ' . $path );     }     $contents['images'] = array( );     $contents['albums'] = array ( );     while ( false != ( $f = readdir ( $h ) ) )     {         if ( $f != '.' && $f != '..' )         {             if ( is_dir ( $path . $f ) )             {                 $info = dir_info ( $path . $f );                 $contents['albums'][] = array ( 'name' => $f, 'albums' => $info['dirs'], 'images' => $info['files'] );             }             elseif ( preg_match ( '#.jpg$#i', $f ) )             {                 $info = getimagesize ( $path . $f );                 $dimension = $info[0] . 'x' . $info[1];                 $contents['images'][] = array ( 'name' => $f, 'dimension' => $dimension, 'modified' => filemtime ( $path . $f ), 'size' => filesize ( $path . $f ) );             }         }     }     return $contents; } function dir_info ( $dir ) {     $dir = $dir != '' && $dir != '/' ? trim ( $dir, '/' ) . '/' : '';     $h = @opendir ( $dir );     if ( !$h )     {         exit ( 'Unable to open ' . $dir );     }     $count['dirs'] = 0;     $count['files'] = 0;     $count['size'] = 0;     while ( false != ( $f = readdir ( $h ) ) )     {         if ( $f != '.' && $f != '..' )         {             if ( is_dir ( $dir . $f ) )             {                 $count['dirs']++;             }             else             {                 $count['files']++;                 $count['size'] += filesize ( $dir . $f );             }         }     }     return $count; }[/code] so if you could please help me to make it so that the functions above ignor .thumbs and .resized that would be just great, I am not a php programmer so im a little lost on this one, I have managed to to some things in php but no matter what I try it just isnt working for me. ps you can see an example of what I mean by going to this link [a href=\"http://www.sitebuz.com/memsites/tester/gallery/index.php?album=test&sortby=name&order=asc\" target=\"_blank\"]http://www.sitebuz.com/memsites/tester/gal...=name&order=asc[/a] thank you
×
×
  • 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.