PHP Random Image extension

Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.

  1. #1

    Default PHP Random Image extension

    I am trying to use the PHP random image generator but I don't know where to
    specify the size I want all the pictures to come up in the code. I created a
    "php" test page and inserted said code where I want the images to display but
    they are too large and throw the entire page off. Is there a way to tell it
    that all pictures should be called up at 240(width) x 350(height)? Any help
    would be greatly appreciated. The reason I am doing this is because there are
    about 200 images (of students) in this folder and coding each picture
    seperately is too time consuming.

    Regards,
    RM (using DW MX2004)

    <?php
    $folder=opendir("testwisdroyphppics/");
    while ($file = readdir($folder))
    $names[count($names)] = $file;
    closedir($folder);
    sort($names);
    $tempvar=0;
    for ($i=0;$names[$i];$i++){
    $ext=strtolower(substr($names[$i],-4));
    if
    ($ext==".jpg"||$ext==".gif"||$ext=="jpeg"||$ext==" .png"){$names1[$tempvar]=$name
    s[$i];$tempvar++;}
    }
    srand ((double) microtime() * 10000000);
    $rand_keys = array_rand ($names1, 2);
    $xmImg="testwisdroyphppics/".$names1[$rand_keys[0]];
    $dimensions = GetImageSize($xmImg);
    if (isset($pic)){header ("Location: $xmImg");}
    else {echo "<img src=\"$xmImg\" $dimensions[3]>";}
    ?><

    rmartine2007 Guest

  2. Similar Questions and Discussions

    1. Looking for a random image extension
      Does anybody know of a good FREE extension that will put a random image inside a cell of a table? I'm actually looking to do two different...
    2. Stopping the same random image
      Hi, I am loading 8 images into 8 movie clips using a random number generator. it is working but it loads in the same images in places. I need the...
    3. Random image display
      I am doing a website, www.jishanair.com/test I currently on the homepage have a huge image, which i want to change randomly whenever someone...
    4. Random image?
      Is there a way to create a random image (like in hotmail registration) and ask user to enter the information during their registration. I think,...
    5. Random image in a random place.
      Anyone know javascript? I have a grid(4 x 4) of 16 spacer images and a few text links on the side. Each text link represents a different folder of...
  3. #2

    Default Re: PHP Random Image extension

    Disregard....I figured it out. As it turns out the best solution would be to
    have your original pictures saved with the desired dimensions. I was able to
    point the PHP to a directory that contained pictures with said dimensions and
    it worked like a charm.

    regards.

    rmartine2007 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139