Jump to content

hp1

Members
  • Posts

    76
  • Joined

  • Last visited

About hp1

  • Birthday 02/17/1975

Previous Fields

  • Languages
    HTML, CSS, PHP

Contact Methods

  • Website URL
    http://
  • ICQ
    0

Profile Information

  • Location
    Bristol, UK

hp1's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Cheers I'll have a play with these two functions.
  2. Shamefully I have nothing for this little problem other than existing array thats holding all the images. Needing a loop was about as far as i'd got.... I cant figure out the code that will then slice that array up into 5s into separate smaller arrays.
  3. Hi,Been ages since I fiddled with one of my sites. Its a simple gallery that shows thumbnails as subsets of 5 images that can be scrolled through 5 at a time.I've managed to read all of the images in the directory into an array stripping out . and .. but now I'd like to iterate through that array taking each 5 images into a new array something like $imagearray= array(image1, image2.........image 10)some code here that give me.....$sub1=array(image1, image2.....image5);$sub2=array(image6, image7.....image10); This will the allow me to use the images in groups of 5.I suspect this is easier than I think it is, i just cant figure it....Appreciate any tips.cheers
  4. Hi All. Been away from PHP for 6 months or so and refreshing an old project. I'm building a site for a musician friend and I have implemented the JW Player. I've used a simple drop down form to allow the user to select different playlists. The problem is that the music player is at the bottom of the page and after the form submits it reloads at the top causing the user to have to scroll back down to the player at the bottom to use the freshly loaded playlist.Is there a way to add an anchor that can be called by the $PHP_SELF? (probably not a good way of describing it but hopefully you get the gist!)Form: <form name="loadalbum" method="post" action="<?php echo $PHP_SELF;?>"> <select name="albumselect" onchange='this.form.submit()'> <option selected>Choose Album</option> <option value="aiw">All I Wanted</option> <option value="go">Go!</option> </select> </form> Player: <?phpif(!isset($_POST['albumselect'])){$list='aiw';}else {$list=$_POST['albumselect'];}?><script type="text/javascript"> var so = new SWFObject('player.swf','mpl','350','200','9'); so.addParam('allowfullscreen','true'); so.addParam('flashvars','file=<?php echo 'audio/'.$list.'.xml'; ?>&playlist=over&skin=flashskins24blackBlue.swf'); so.write('player');</script>
  5. True, but it will only ever be me that uploads images to the gallery and therefore will always be jpegs. A fair point tho
  6. Interesting you should say that, I did exactly that. I used a different script that generated all the thumbnails to a thumbs/ directory. It doesnt seem to have made any difference which makes me think I have more serious problems with my server. I also removed a script that was generating HTML and just replaced it with code from 'view source' and is also makes no difference which sort of confirms that maybe my server has problems. I have contacted my host for help. Anyway just in case there are huge flaws in the script I am using here it is:The page is written using this:<?php$dir = "eb";if ($handle = opendir($dir)){ while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != ".htaccess" && $file != "ir.php" && $file != "vids" && $file != "tg.php" && $file != "tg2.php" && $file != "thumbs") { $name_array[] = $file; }}closedir($handle);}asort($name_array);while(list($key,$val)=each($name_array)){echo "<a href=\"eb/wide/$val\" rel=\"shadowbox[eb]\" title=\"\"><img class=\"gal\" src=\"eb/small/$val\" border=\"0\"></a>";}?> The two images (the thumbnail and the actual image to be displayed) are generated using GD using a PHP script and a .htaccess as follows: <?php// max_width and image variables are sent by htaccess$max_width = $_GET['max_width'];$max_height = 1000;$image = $_GET['image'];$size = GetImageSize($image);$width = $size[0];$height = $size[1];// get the ratio needed$x_ratio = $max_width / $width;$y_ratio = $max_height / $height;// if image allready meets criteria, load current values in// if not, use ratios to load new size infoif ( ($width <= $max_width) && ($height <= $max_height) ) { $tn_width = $width; $tn_height = $height;} else if (($x_ratio * $height) < $max_height) { $tn_height = ceil($x_ratio * $height); $tn_width = $max_width;} else { $tn_width = ceil($y_ratio * $width); $tn_height = $max_height;}// read image$src = ImageCreateFromJpeg($image);// set up canvas$dst = imagecreatetruecolor($tn_width,$tn_height);// copy resized image to new canvasImageCopyResized($dst, $src, 0, 0, 0, 0, $tn_width,$tn_height,$width,$height);// send the header and new imageheader('Content-type: image/jpeg');ImageJpeg($dst, "", 90);// clear out the resourcesImageDestroy($src);ImageDestroy($dst);?> .htaccess file: RewriteEngine onRewriteBase /eb/# scaling small, medium, largeRewriteRule ^small/([A-Za-z0-9_.]+).(jpg|gif|png|JPG)$ ir.php?max_width=70ℑ=$1.$2RewriteRule ^medium/([A-Za-z0-9_.]+).(jpg|gif|png|JPG)$ ir.php?max_width=200ℑ=$1.$2RewriteRule ^large/([A-Za-z0-9_.]+).(jpg|gif|png|JPG)$ ir.php?max_width=400ℑ=$1.$2RewriteRule ^wide/([A-Za-z0-9_.]+).(jpg|gif|png|JPG)$ ir.php?max_width=640ℑ=$1.$2
  7. Yes, Imagedestroy is being used twice, once for destroying after Imagecreatefromjpeg and once for imagecreatetruecolor. Thanks for the suggestion tho
  8. hp1

    Best Php Editor

    I really like Notepad++. It highlights syntax as well and also has a bunch of optional features. Its great for identifying errors in code like highlighting pairs of curly brackets {} etc
  9. I have a script that generates thumbnails and larger images from an original. The script works but I have noticed that when my gallery pages have a lot (i.e. 100) of thumbnails to generate it freezes the page. some of the thumnails have been successfully created while others have not. It appears to be worse on less powerful machines. How can i tell if the script is causing the server to run out of memory or not or indeed, is this the problem?
  10. Ok i've tried a few simple things. But nothing happens. When I test it (by pressing the submit button) the page remains and the only way you can tell something is supposed to be happening is that the usual browser progress bar is blank.Because the upload script is sending a request to the server do I need to use javascript in order to get the browser client to display something until the server request (uploading the file) has finished?
  11. I dont want a progress bar. I just want to show my users that the server is busy while the file they have submitted for upload is uploading. I have a max file size of 10MB so potentially they could be staring at a page that is not doing very much for quite a while depending on their connection speed.Either an animated gif or a <div> that appears (like the one that appears if you do a search on this forum) would be sufficent. I can post my upload.php file if necessary.Thanks
  12. Yeah thats spot on. Promise I googled, I did, maybe using wrong search expression :)Thanks
  13. Hello all,Just finished another site and as usual the dull bit is now adding lots of security to the forms, including scanning text areas for offensive words or spam. I could just get imaginitive but I thought there might be a resource out there somewhere that had a nice big CSV list.Anyone come across such a thing?
  14. Try this tutorial:http://www.w3schools.com/PHP/php_mail.asp
×
×
  • Create New...