I will try it tonight. It may take me a couple of times to tweak it etc. Once succcesful or if questions I will post either way. Thanx again for the help.

    I will keep my subscription to this threat, then.

    If you have questions that pertain to this script/thread, feel free to reply. If not, make sure you mark this thread as "RESOLVED" using the link, so that I know I can cancel my subscription.

      I dont know what im doing wrong i put the code in the following linked page www.egelands.com/new.php and then I created an htm file with the reference you mentioned above at www.egelands.com/new2.htm. and I get nothing. My folder path is ce/trips/arizona. Any ideas. Thx

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Untitled Document</title>
        </head>

        <body>
        <img src="new.php">
        </body>
        </html>

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
          <title>Untitled Document</title>
          </head>

          <body>
          <?php
          header('Content-type: image/jpeg');

          // --- BEGIN CONFIGURATION ---

          $path = 'ce/trips/arizona/';
          $width = 175;
          $height = 250;

          // --- END CONFIGURATION ---

          $files = @glob(realpath($path) . '/{.JPG,.jpg,.JPEG,.jpeg}', GLOB_BRACE);
          if($files === FALSE) die();
          $filename = $files[rand(0, count($files)-1)];

          list($width_orig, $height_orig) = getimagesize($filename);

          if ($width && ($width_orig < $height_orig)) {
          $width = ($height / $height_orig) $width_orig;
          } else {
          $height = ($width / $width_orig)
          $height_orig;
          }

          $image_p = imagecreatetruecolor($width, $height);
          $image = imagecreatefromjpeg($filename);
          imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);

          imagejpeg($image_p, null, 100);
          ?>

          </body>
          </html>

            Change this:

            if($files === FALSE) die(); 

            to this:

            if($files === FALSE) die('GLOB ERROR'); 

            Then refresh the new.php page and tell me what it outputs (if anything).

            EDIT: WAAAAAIT! 'new.php' SHOULD NOT HAVE HTML, NOR ANY OUTPUT other than the PHP code. Get rid of EVERYTHING outside of the PHP tags. This page is NOT meant to be XHTML compliant, or whatever standard you're using. THIS IS MEANT TO BE AN IMAGE; no one should ever see the source.

              <?php
              header('Content-type: image/jpeg');

              // --- BEGIN CONFIGURATION ---

              $path = 'ce/trips/arizona/';
              $width = 175;
              $height = 250;

              // --- END CONFIGURATION ---

              $files = @glob(realpath($path) . '/{.JPG,.jpg,.JPEG,.jpeg}', GLOB_BRACE);
              if($files === FALSE) die('GLOB ERROR');
              $filename = $files[rand(0, count($files)-1)];

              list($width_orig, $height_orig) = getimagesize($filename);

              if ($width && ($width_orig < $height_orig)) {
              $width = ($height / $height_orig) $width_orig;
              } else {
              $height = ($width / $width_orig)
              $height_orig;
              }

              $image_p = imagecreatetruecolor($width, $height);
              $image = imagecreatefromjpeg($filename);
              imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);

              imagejpeg($image_p, null, 100);
              ?>

                Make a script called phpinfo.php, make the contents this:

                <?PHP
                phpinfo();
                ?>

                Gimme the url when that's done!

                  Not sure if PHP 4.3.10 includes the GD library bundle or not, but either way, your server was not compiled with the GD library.

                  My script relies on GD library to do the resizing. Since you do not have this, either find another server you can host this script that DOES have the GD library, or else... I don't know what to tell you 😛

                  Maybe try contacting the server administrator and asking him about the GD library.

                    Thanks for all the help. I am going to send this thread to abac.com to see if they can do something about getting GD. Thanks,

                      They say we have that

                      stoiang: We have that

                      stoiang: what is your hosting plan

                      Visitor81064: solo xr

                      Visitor81064: unix

                      stoiang: Will send you a link wich will help you to enable the gd

                      I will get back to you on this, thanks

                        They said all i need to do is upload a file to my root directory
                        as php.ini and then upload to root dir

                        They are working on it for me. I should have it up soon. I will post it when they have put it up. Then your script should work.

                          The client support guy at abac said he fixed the problem. Here is the link to phpinfo.php again to see if enabled, i cant tell by looking at it if it is. http://www.egelands.com/phpinfo.php

                          Thanks

                            www.egelands.com/randpic.php

                            code

                            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
                            <html>
                            <head>
                            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                            <title>Untitled Document</title>
                            </head>

                            <body><?php
                            /*

                            Random Image Generator

                            This script will scan a directory of your choosing, ignoring folders and

                            the dreaded Thumbs.db file and then return a randum image from the specified

                            folder. Easy to customise and use :-) I recommend using include() with this.

                            #

                            This code is free to use and written by Steven Davies. If you do use, please

                            leave the comment in a code so other web authors can find this site!

                            #

                            This code was taken from www.phub.co.uk

                            /
                            /
                            Customise this line to change to your images folder /
                            $dir = 'ce/trips/arizona/bigimages';
                            $dh = opendir($dir);
                            /
                            The following loop scans the directory specified ignoring folders and Thumbs.db /
                            while (false !== ($filename = readdir($dh))) {
                            if($filename == "Thumbs.db" || is_dir($filename)){
                            }else{
                            $tempArray = explode(".", $filename);
                            /
                            Add image file types in the code below */
                            if($tempArray[1] == "jpg" || $tempArray[1] == "gif" || $tempArray[1] == "png" || $tempArray[1] == "tif" || $tempArray[1] == "bmp"){
                            $files[] = $filename;
                            }
                            }
                            }

                            / Generate a random number /
                            $nooffildi = count($files);
                            $nooffiles = ($nooffildi-1);
                            srand((double)microtime()*1000000);
                            $randnum = rand(0,$nooffiles);

                            / print the result /
                            echo "<IMG SRC='$dir/$files[$randnum]' ALT='$files[$randnum]' BORDER='0'><br>";
                            echo "<!--Code Written By Steven Davies : www.phub.co.uk -->";

                            ?>

                            </body>
                            </html>

                              Now if i could just get some code to show those randomized pics, in a rather large thumbnail size on my homepage to have the "Picture of the moment". It would rock. www.egelands.com

                              Any takers? Thnks

                                http://www.egelands.com/test.php

                                code

                                <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
                                <html>
                                <head>
                                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                                <title>Untitled Document</title>
                                </head>

                                <body><? include('randpic.php'); ?>

                                </body>
                                </html>

                                IDeally I would like to have somthing like that included on the homepage but for it to be reduced to a much more thumbnail like size. ???? Is this even possible?

                                  Write a Reply...