I am using php libvips library. I applied one image operation on one image file, now i want to store same file in my folder. But vips give me error if my source and destination both file are same. Is there any solution for that?
I am using $image->writeToFile();
for store the my file
libvips is a streaming image-processing library -- pixels are processed from source to destination in a series of small chunks, and entire images are not held in memory. This means the source file and destination file must both exist at the same time, which means you can't use the same filename for both.
The best solution is to write to a temporary file, then rename the temporary file over the source file once processing finishes.