function avatar_selection_image_delete in Avatar Selection 6
Same name and namespace in other branches
- 5.2 avatar_selection.module \avatar_selection_image_delete()
- 5 avatar_selection.module \avatar_selection_image_delete()
- 7 avatar_selection.admin.inc \avatar_selection_image_delete()
Delete the specified avatar image.
Parameters
$image: Path to the image to be deleted.
2 calls to avatar_selection_image_delete()
- avatar_selection_edit_delete_form_submit in ./
avatar_selection.admin.inc - Submit the image list form in the Avatar Selection - 'Manage Avatars' page.
- _avatar_selection_scan_images in ./
avatar_selection.admin.inc - Scan the directory for new files.
File
- ./
avatar_selection.admin.inc, line 709 - Administrative page callbacks for the avatar_selection module.
Code
function avatar_selection_image_delete($image) {
$dir = file_create_path('avatar_selection');
if (file_check_location($dir . '/' . $image, $dir)) {
$aid = db_result(db_query("SELECT aid FROM {avatar_selection} WHERE avatar = '%s'", $image));
if ($aid) {
$result = db_query("DELETE FROM {avatar_selection} WHERE aid = %d", $aid);
$result = db_query("DELETE FROM {avatar_selection_roles} WHERE aid = %d", $aid);
$result = db_query("DELETE FROM {avatar_selection_og} WHERE aid = %d", $aid);
file_delete($dir . '/' . $image);
if (!image_get_info($dir . '/' . $image)) {
return 1;
}
}
}
return 0;
}