$value) { // delete normal tag if it exists if (is_array($image->tags)) { $index = array_search($value[0], $image->tags); if ($index !== false) { $tagarray = $image->tags; unset($tagarray[$index]); $image->clearMetadata('tags'); $image->tags = $tagarray; } } else { if ($value[0] === $image->tags) { $image->clearMetadata('tags'); } } // delete the photo tag annotation delete_annotation($id); } system_message(elgg_echo("tidypics:deletetag:success")); forward($_SERVER['HTTP_REFERER']); ?>