Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Yaz
    Yaz is offline
    Junior Member
    Join Date
    Jul 2003
    Location
    Toronto
    Posts
    21
    Member #
    2327
    There is a problem with this code, it displays a random image from a folder, but once in a while it gives me this error:

    [B]Warning : getimagesize: Unable to open '' for reading. in /Library/WebServer/Documents/randomizer.php on line 18
    ..:: Yaz ::..

  2.  

  3. #2
    Yaz
    Yaz is offline
    Junior Member
    Join Date
    Jul 2003
    Location
    Toronto
    Posts
    21
    Member #
    2327
    here is the rest:

    I checked for all the images in that folder, there is nothing unusual.

    Here is the code:
    ..:: Yaz ::..

  4. #3
    Yaz
    Yaz is offline
    Junior Member
    Join Date
    Jul 2003
    Location
    Toronto
    Posts
    21
    Member #
    2327
    damn.. one more try:

    I checked for all the images in that folder, there is nothing unusual.

    Here is the code:
    ..:: Yaz ::..

  5. #4
    Yaz
    Yaz is offline
    Junior Member
    Join Date
    Jul 2003
    Location
    Toronto
    Posts
    21
    Member #
    2327
    sorry, its not displaying the code...

    one more try:


    $dir = "/Library/WebServer/Documents/images/thumbs/";
    $html_dir = "directory";
    $dir_handle = opendir($dir);
    $img_array = array();


    while ($file = readdir($dir_handle))
    {
    if (($file !=".") && ($file !="..") && (substr($file, -4) == ".jpg"))
    {
    $file_name = "$html_dir/$file";
    $img_array[$file_name] = $file_name;
    }
    }

    sort($img_array);

    $count = count($img_array);

    for($item = 0;$item < sizeof($img_array); $item++)
    {
    $image[$j++] = rtrim($img_array[$item]);
    }

    $random = rand(0,$count-1);

    $size = getimagesize($image[$random]);
    $width = $size[0];
    $height = $size[1];

    $img_src = "<img src=\"$image[$random]\" width=\"$width\" height=\"$height\" alt=\"Random Image\" class=\"picBorder\" />";

    closedir ($dir_handle);
    ..:: Yaz ::..


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:05 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com