Reputation: 8555
I'm trying to programmatically add a tint to an image. I've done this very easily with a form and the $_FILES array but I need to get the image from a URL, and the images I'm trying to use are on my own server if that is important. Here's a sample code of the working form function
$img = new Upload($_FILES['imgfile']);
Now all I need is something like $img = new Upload(fopen($image_path);
But this isn't working... Please help me!!
Upvotes: 0
Views: 449
Reputation: 157839
Well, you can fake $_FILES array all right.
the only function you cannot fool with this array is move_uploaded_file() but it seems you don't need it anyway.
but, you know, nobody have an idea what your "new Upload" is.
Upvotes: 0
Reputation: 117313
In the following code, you are passing a $_FILES array structure to your Upload class:
$img = new Upload($_FILES['imgfile']);
The variable $_FILES['imgfile']
itself is an array, consisting of named members such as 'name'
, 'tmp_name'
and others - information about the file that has been passed to PHP by the server receiving the uploaded file.
Your Upload
class appears to be designed to handle this sort of structure. It will probably have been designed specifically for handling file uploads, so you may need to modify it a bit to allow it to be passed any file path as a parameter instead of this array structure.
Upvotes: 2