Jump to content

open url


Boerke

Recommended Posts

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
Link to comment
Share on other sites

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

[code]
$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 />';
        }
[/code]

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.