Resize or Create Thumb - Deletes Original

See all posts Reply

Resize or Create Thumb - Deletes Original new!
by Brian DiChiara, 14 years, 2 months ago
I've created an Image Resize interface that simply allows you to create thumbnails of images. The problem I'm having is the original file is being altered (or deleted) and I can't figure out what is going on.

This is the code:
http://solepixel.pastebin.com/8pJi2Lcq

Here's a demo of the interface:
http://screencast.com/t/ZTVjYzRi

In the video, the first time, the thumbnail isn't getting created. The 2nd time the original image gets deleted. It's supposed to be copying the original the first time and creating a thumb (-thumb.jpg) and just a straight up resize the 2nd time.

Anyone had this same issue know how to fix it?Reply
Re: Resize or Create Thumb - Deletes Original new!
by colin, 14 years, 2 months ago
I cannot see your screen cast, but I assume you are not uploading a file; you are working on a file already on the server.

If you use clean(), it will delete your source image. Remove the following line in your code:
$handle->clean();

clean() is used for uploads to delete the uploaded file, and eventually when working on local files if you want to delete your original file.Reply