Jump to content

son

Members
  • Content Count

    1,024
  • Joined

  • Last visited

Everything posted by son

  1. son

    Jquery Scripting

    The whole script is still the same I am working on at present as <script type="text/javascript">// init vars<?php if (isset($_GET['cid'])) { $cid = $_GET['cid']; } else { $cid = 1; }?>var imageGallery = "<?php echo $cid;?>";var imageTotal;var imageNo;var aniRunning = false;var slideRunning = true;var imageDir = "gallery";var imageWidth;var slideInterval;$(document).ready(function() {getTotal();});// FUNCTIONS BELOW// get image totalfunction getTotal(){$.get(imageDir + "/thumb/files.php?cid=<?php echo $cid;?>", function(data){ imageArray = data.split("|"); ima
  2. In a JavaScript I had to change image names from integers to strings and cannot get my head around some changes that are necessary in script. When clicking onto thumbs the relevant main image should be displayed and clicking onto previous button should go to image that is stored in array beforehand. The code is (the bold bits are where I changed from i): function loadThumbs(){for(var i=0; i < imageArray.length; i++) { thumbPath = '<a id="' + i + '" href="#" onclick="thumbClick(this.id);return false;"><img src="' + imageDir + '/thumb/' + [b]imageArray[i][/b] + '" alt="photo" />
  3. Thanks. Will try this... Son
  4. That is not an issue. I do not need anything above or below within the box. I only display some text in div that is absolutely aligned with the relative box (on top of the box with a higher stack order). Think that is what I need... Many thanks,Son
  5. When I said 'I did this before, but there are no errors whatsoever.' that was meant to say that I checked the errro console, but there are no errors, warning, messages whatsoever... I only used document.write to see what the values are, this should have not been in the 'real' life script, but I am open to suggestions how to be check what values are when I am debugging. What would you normally use? Also, what do you mean by logging everything? The error console does this automatically, doesn't it? Son
  6. I did this before, but there are no errors whatsoever. However, I tried nowdocument.write(imageArray.length); which shows 0anddocument.write(imageTotal); which brings up 'undefined'but I am not getting why the function would not be called. I have at top$(document).ready(function() { getTotal();});// FUNCTIONS BELOW// get image totalfunction getTotal(){ $.get(imageDir + "/thumb/files.php", function(data){ imageArray = data.split("|"); imageArray.pop(); imageTotal = imageArray.length; imageNo = 1; loadNavi(); // load thumbnails loadThumbs();
  7. Gosh, lots of different approaches to think about. As for the method with 'max-height with CSS' I am not sure what this means. Simply declare a max-height (and/or width) and then images is re-sized in pure css accordingly? Is this what you mean. I would not have thought this possible... Son
  8. How would I check for errors? The page does not show any issues as such... Son
  9. So, you manipulate images with php when you load them from server for display? Or do you do this better with Javascript? Thanks,Son
  10. I am working on this script in other post which is not resolved yet, but have a general Javascript question relating to this. When I try to use:function loadThumbs(){ for(var i=0; i < imageArray.length; i++) { thumbPath = '<a id="' + i + '" href="#" onclick="thumbClick(this.id);return false;"><img src="' + imageDir + '/thumb/' + imageArray + '" alt="Photography" /></a>'; $('#thumbnails').append(thumbPath); }}nothing is being appended to the div called 'thumbnails'. When I directly place:<div id="thumbnails"><script type="text/javascript">
  11. I am working with a new slideshow where the images can be landscape, square or portrait. They will be randomly loaded and as I cannot rely on any size I am not sure how to best deal with this. Did anyone of you come across a similar problem and if yes, what did you decide to do about it? Thanks,Son
  12. As I am still lost read now the complete JavaScript beginners section and started to play around with simple things as:<script type="text/javascript">var i;var files = new Array();files[0] = "png_lower.png";files[1] = "jpg_lower.jpg";files[2] = "gif_lower.gif";</script></head> <body><script type="text/javascript">// Now we have a files array in Javascript. Example usage:for(i=0; i < files.length; i++) { // files is the current filedocument.write('<img src="images/thumb/' + files + '" alt="Photography" />');}</script>which shows up fine. So far , so
  13. I have used scandir before, but am not sure how to fit this (or anything else) in with the existing script. Son
  14. I use the following script to click through photos on a web page (and see all photos as thumbs if overview graphic is clicked):<script type="text/javascript" src="js/jquery.js"></script><script type="text/javascript">// init varsvar imageGallery = "1";var imageTotal;var imageNo;var aniRunning = false;var slideRunning = true;var imageDir = "images";var imageArray = new Array();var imageWidth;var slideInterval;$(document).ready(function() { getTotal();});// FUNCTIONS BELOW// get image totalfunction getTotal(){ $.get(imageDir + "/thumb/files.php?galID=1", function(data){ imageA
  15. Hi Ingolme,Thanks for your help. I simply cannot get it work and wondered if I could clarify one things first:REQUEST_FILENAME: this is what the user enters, isnt' it? For example www.domain.co.uk/var_name/index.php instead of www.domain.co.uk/files1/index.php?id=var_name.This is why I think I can only exclude the other directories. The querystring could hold any variable name, so I cannot anticipate what there is to come...Anyway, I want to exclude the folder and all files inside the folder 'photos'. Using:RewriteCond {REQUEST_FILENAME} !^/photos.*or RewriteCond {REQUEST_URI} !^/photos.*simpl
  16. But I would like to apply the rewrite only to the files1 directory, but not to the photos folder (or any files in it). So, in a way it is both a directory if you see what I mean. How would I do this? Son
  17. I have a mod rewrite for index file in directory working now as Options +FollowSymlinksRewriteEngine OnRewriteCond {REQUEST_URI} !^/photos/index.phpRewriteRule ^([A-Za-z0-9-]+)/?$ /files1/index.php?id=$1 [NC,L] The RewriteCond makes sure that the index.php in photos folder is not affected by the general re-write of any string consisting of numbers, letters or/and hyphens... However, in my photos folder there are a lot of files and it would be much better to somehow say that everything in folder would should be excluded. Also, there are two other folders with same exception. How can I add thi
  18. Thanks for reply. Found the error now. You could not use localhost, but had to specify the path to db...Son
  19. I get the error message:Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2002): Can't connect to local MySQL server through socket '/tmp/mysql.sock'when I try to connect to a hosted database.Looking so far through the help I could find online, the suggestions refer to changes in server settings, a thing I cannot change. Is there anything else I could do? Other than php files and phpMyAdmin access there is not much I can else...Son
  20. Thanks for code. Copied it and will have a play around with it:-)Cheers,Son
  21. son

    switch in mysql statement?

    Thanks. I have it working now, but have one question with regard to your statement 'When you get to the generics, only display them if the flag is true'. The generic ones are the last ones to be returned and I have done the check regarding your statement as:if (($imgCat == 7 && $genBanner) || ($imgCat != 7 && !$genBanner)){code} It works, but am not sure if that was what you meant. If there is a more efficient way, please let me know..Son
  22. I have a function that resizes images if the size is too wide as: if ($w > $width) { $ratio = $width / $w; // ratio is max width divided by actual (<1) $img = imagecreatetruecolor($width, round($h * $ratio)); // height is actual height times ratio (less) imagecopyresampled($img, $orig, 0, 0, 0, 0, $width, round($h * $ratio), $w, $h); $orig = $img; $w = imagesx($orig); $h = imagesy($orig); } Works well and very useful unless you try to upload a transparent image. It shows as the manual states a black box which does not show when
  23. I am wrecking my brain now for some time, but I cannot see the answer to my issue. I retrieve data from a db as: $query = "SELECT img1, imgTitle, imgCat FROM hyr_images WHERE hyrID = $HID AND (imgCat = $pid OR imgCat = 7) ORDER BY imgCat ASC"; I display the retrieved images on a several web pages and try to display the images for a specific page (assessed via imgCat). If no specific images are displayed the generic ones will be displayed (imgCat = 7). With my current setup page specific ones come first and then the generic ones, but I do only want to display the generic ones if there is not
  24. I have the script Options +FollowSymlinksRewriteEngine OnRewriteRule ^files/([^/]+)\/index.php files/index.php?id=$1 [NC] working fine, but struggle with some fine-tuning.I would like to skip 'files/' altogether, but trying things like RewriteRule ^([^/]+)\/index.php files/index.php?id=$1 [NC] does not work.Also, there are occasions where user might just enter www.domain.co.uk/$1. How can I make sure those also get to $1/index.php?id=$1?Son
  25. Thanks, Deirdre's Dad. I tried this earlier on and this showed the link ok (as long as I entered it correctly in lowercase obviously). Not sure what is not working in my script correctly...Son
×
×
  • Create New...