I noticed a rather nasty bug in ngg.uploadImage.
If you specify overwrite=true and provide a new file name for an existing
image, the plug-in replaces the original photo, however the thumbnail keeps the
old name. Also, the database information for that image remains unchanged. So
if you attempt to rename the photo one more time the call would fail with with
a "Failed to delete image" error (because the name in the database no longer
matches the filename.
I am suggesting the following changes:
1. delete the thumbnail after deleting the original image:
if ( !@unlink( $image->thumbPath ) ) {
$errorString = sprintf(__('Failed to delete thumbnail %1$s ','nggallery'), $image->thumbPath);
logIO('O', '(NGG) ' . $errorString);
return new IXR_Error(500, $errorString);
}
2. update the filename and reset the image after placing the uploaded photo in
the destination folder:
if(!empty($data["overwrite"]) && ($data["overwrite"] == true)) {
if ($filename != $image->filename) {
$result = nggdb::update_image($pid, false, $filename);
$image = null;
}
}
What WordPress / NextGEN Gallery version are you using? 1.9.2
Please provide any additional information below.
I discovered this issue while testing the XMLRPC integration with the NextGEN
Gallery Export plug-in for Adobe Lightroom
(http://alloyphoto.com/plugins/nextgen/)
Original issue reported on code.google.com by v...@alloyphoto.com on 25 Feb 2012 at 2:57
Original issue reported on code.google.com by
v...@alloyphoto.com
on 25 Feb 2012 at 2:57