There is a function in WordPress that allows to display a “edit post” link if the user has sufficient rights.
<?php edit_post_link( __( 'Edit' ), '<small class="edit-link">', '</small>' ); ?>
Is there an equivalent for media files / attachments,
UPDATE
This sorts of work
$images = fdw_get_post_images('preview-onepost-thumbnail');
if ($images){
$counter= 0;
foreach ($images as $image){
$src = $image['src'];
$info = $image['info'];
edit_post_link( __( 'Edit image' ), '<section><small class="edit-link">', '</small></section>', $info->ID ); ?>
But the user actually need to be able to Delete the image. That screen does not allow it.
This isn’t 100% complete, but should be a good start for you.
A couple notes on what you’ll have left to do:
?attachment_id=704&deleted=1
. You’ll want to intercept front-end attachment requests where$_GET['deleted'] == '1'
and handle that gracefully (e.g. redirect).