Jump to content

calvin182

Members
  • Posts

    190
  • Joined

  • Last visited

Posts posted by calvin182

  1. okay so i've got it to sort in reverse order so the most recent image is placed atop and the olders on bottom using rsort(); heres what that looks like:

    <?php$dir = '/home/******/public_html/gallery/nwb';$imgs = array();if (is_dir($dir)) {   if ($dh = opendir($dir)) {       while (($file = readdir($dh)) !== false) {            if(($file != '.') && ($file != '..')) {                      $imgs[] = $file; }       }       closedir($dh);   }}rsort($imgs);// you can use print_r() for debugecho "<pre>";print_r($imgs);echo "</pre>";?>

    now i need to figure out how to make these in image format. what i want to do is put these into a 4x4 table (16 images per page). all in all this gallery is almost 6 pages. so i doubt theres a way to make it put the 16 most recent images always on the first page and so on so the last page has the oldest images because the script probably wouldnt autogenerate a new page when needed. is there a way to do that? if not putting all thumbnails on the same page will have to do.

  2. the example of readdir() i've tested is:

    <?php// Note that !== did not exist until 4.0.0-RC2if ($handle = opendir('/path/to/files')) {   echo "Files:\n";   /* This is the correct way to loop over the directory. */   while (false !== ($file = readdir($handle))) {       echo "$file\n";   }   closedir($handle);}?>

    but what it does is it also returns directories, which I totally don't need, but to put them in the array, would I do somehting like:

    <?php// Note that !== did not exist until 4.0.0-RC2if ($handle = opendir('/path/to/files')) {   echo "Files:\n";   /* This is the correct way to loop over the directory. */   while (false !== ($file = readdir($handle))) {       $imgs = array();       $imgs[] = $item_to_add;       sort($imgs);   }   closedir($handle);}?>

    or would it be a different approach?

  3. I've searched the net but I havent found exactly what I am looking for so I thought that maybe I can post here and try to learn a little.In regards to the examples to readdir(), I obliviously read the examples because I ended up testing one out like I stated, but I don't understand how to put the data into an array. I am very new to PHP and I am trying to learn but everyonce in a while I need some help from somebody else... That's why I posted here :)

  4. I think this is what you are looking for...content.txt:

    <?php //Poem 1...if ($_GET["poem"]=="1"){     echo "roses are red"; exit();}//Poem 2 and on...elseif ($_GET["poem"]=="2"){     echo "violets are blue"; exit();}elseif ($_GET["poem"]=="3"){     echo "sugar is sweet"; exit();}elseif ($_GET["poem"]=="4"){     echo "and so are you"; exit();}//IF NO POEM IS SELECTEDelse {echo "No poem selected"; exit();};?>

    ..and so on and so on. If you need to use quotes in your poem you need to cancel the out with \" like this:

    elseif ($_GET["poem"]=="5"){     echo "she said \"I love you\" and got on the train"; exit();}

    The exit(); is in there so once the correct poem is retrieved, the rest of the script isnt parsed.Now, include the above script in your page with the following code

    <?php include("http://www.yourdomain.com/content.txt"); ?>

    Be sure to change yourdomain.com to your actual domain.And remember, to call a specific poem, make sure the url called is http://www.yourdomain.com/index.php?poem=2 and poem 2 will be inserted into that page.

  5. Is there a way to make a gallery that I can update simply by placing the image in the directory and it will place the most recent image in the front (so it sorts the images in desending order by image name). I want to display the images in thumbnail format in rows of 4 and maybe about 6 rows per page.Does anybody know of any snippets that might help me out on this? I don't want one of those premade galleies like eSPG or Coppermine, I just want something that I can insert into my existing theme. Any snippets, tutorials, or ideas would really be a huge help to me please. Thank you!EDIT: I believe I have GD 2.0. I'd rather not do anything with MySQL if possible. I'm sure I won't be able to get every feature I want but any info on anything would be much appreciated.

  6. so how do I use this... I am very new to php here. I guess what I need to figure out is how to upload the image to the code and set it so the output is 100x100 or less (correct proportions). Any advice?

  7. well I can do all the HTML / CSS stuff but the site has multiple authors and they aren't too keen on the coding... yea my server has MySQL but there isnt a way to just write to html files and then include them in my blog templates?

  8. What I want to do is I want to be able to let my site users take an image from their pc, upload it into a thumbnail (max 100x100). Then I want the broswer to display the resized image so the user can save it to their harddrive. I don't want to store the image on my server (unless its temporary and for like an hour tops). I've done some searching on google and can't find what I want, anybody know of any scripts that do this?

  9. Here's the scenario:On my site a few of us have our own personal blog style pages. We have WYSIWYG online HTML editing and thats how we update our pages. I'm about to redesign the entire site, and instead of blogs we just want a simple profile. All of my pages have a .PHP extension and some elements of the page are SSI. What I am looking to do is create a web form where all they have to do is input what data they want displayed on their page and press save. What is the best way to go about this?My server does not support ASP, please help...

×
×
  • Create New...