Search code examples
phpimagefileimagemagick

PHP set an image on my server as uploaded temp file


I am editing a photo gallery script to allow the use of TIFF to be uploaded and saved, but i must keep the files in jpg format also for web viewing.

What I have done is installed Image Magick to convert TIF to JPEG, once i have it converted I want the script to continue with making thumbnails, zoom images, etc. it makes them from $_FILES['image']['tmp_name']

Is there a way to set my newly created file as $_FILES['image']['tmp_name']? my new jpeg file path is set to $nw.

basically I need

$nw='path/to/newfile.jpg';
$_FILES['image']['tmp_name']=$nw;

but it does not work. any ideas?


Solution

  • If you need to work on the same file across multiple page requests, move it somewhere safe using move_uploaded_file.

    If the functions that you wrote require access to $_FILES['image']['tmp_name'], rewrite them to accept the name of the file as a parameter and call them using the new location of the file as argument.