Jump to content


Photo

open url


  • Please log in to reply
3 replies to this topic

#1 Boerke

Boerke
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 02 March 2006 - 12:13 AM

i have a form that let's the user give in an url with pictures, so what i want to do is read that url and display the pictures that were found, but is there a way to do this? because with opendir/readdir i get errors, and also when i change my htaccess file with the url_open stuff, it also doesn't work

#2 Boerke

Boerke
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 02 March 2006 - 02:37 PM

anyone that can send me in the good direction?

#3 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 02 March 2006 - 03:04 PM

Please post your code.

#4 Boerke

Boerke
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 02 March 2006 - 05:24 PM

ok

i read the url folder( for example: [a href=\"http://www.site.com/fotodirectory/\" target=\"_blank\"]http://www.site.com/fotodirectory/[/a] ):
$directory = $_POST['fotodir'];

then i'm using a script i found on the internet to test it

$imgdir = "$directory";
        $allowed_types = array('png','jpg','jpeg','gif');
        $dimg = opendir($imgdir);
        while($imgfile = readdir($dimg))
        {
            if(in_array(strtolower(substr($imgfile,-3)),$allowed_types))
            {
                $a_img[] = $imgfile;
                sort($a_img);
                reset ($a_img);
            }
        }
        $totimg = count($a_img); // total image number
        for($x=0; $x < $totimg; $x++)
        {
            $size = getimagesize($imgdir.'/'.$a_img[$x]);
            // do whatever
            $halfwidth = ceil($size[0]/2);
            $halfheight = ceil($size[1]/2);
            echo 'name: '.$a_img[$x].' width: '.$size[0].' height: '.$size[1].'<br />';
        }

but the error i get
failed to open dir: not implemented in ....php on line ...

and

readdir() not valid argument

so i know that i am supposed to give a local folder, and that's why i asked if there is a method that opens the url instead of just a dir




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users