How about this:
add_filter( 'wp_generate_attachment_metadata', 'delete_fullsize_image' );
function delete_fullsize_image( $metadata )
{
$upload_dir = wp_upload_dir();
$full_image_path = trailingslashit( $upload_dir['basedir'] ) . $metadata['file'];
$deleted = unlink( $full_image_path );
return $metadata;
}
Not 100% sure everything will work ok without the main image, but it does the trick. You wont be able to regenerate the thumbnails / sizes as the main image is required for this.
Edit: I just re-read the question, I noticed you are wanting this to only happen when people upload via a form. Must be early for me, the above code will delete any attachment uploaded. I guess all you would need to do is find someway of checking if the upload was via your gravity form. Hope it helps you anyway.
Related Posts:
- Add custom Attachment Display Setting for images
- How do I detach images from posts?
- upload image in a meta box
- How do I use element instead of tags in WordPress post content having webP support?
- How to remove images from showing in a post with the_content()?
- upload featured image from front end using wordpress add media button
- How do I create Comma Separated list of attached image ids?
- Remove image from post also removes photo from media library
- All my inserted images gets a link to the full image even if it is already full size image
- get custom image size
- How to get only text from wordpress post content?
- Get all images out of the posts content
- how to replace embedded “full” sized images within a post with the “large” ones
- Batch process: remove first image from post content
- how can I put an image in a post with original size
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Comma separated all attached image ID numbers except featured image ID number
- Modify Image Source With The_Content Filter?
- Featured Image uploaded, attached and set but only appearing in the media library
- Load post attached images on a single page site with fancybox
- Format the Layout of Images In The Edit Post Textarea?
- Set size for attachments
- I have a site where attachments in the wp_posts table have guid values of guid, how did this happen?
- CSS: How can I show a photo beyond the template’s column, but contained within the browser window? [closed]
- Get all attachment by post excluding featured and content inside
- Get all images in post and comments like Twitter before post title
- Issue where WP Featured Image will not display
- How would one change the default url structure of attachments?
- Thumbnail Image to go in the post aswell
- Remove Featured Image & All Media Uploaded to the Post
- preg_replace not removed “class”
- update image path with words starting uppercase to lowercase chars
- Upload attachment from external site
- Make insterted image point to post url instead of attachment page
- Get URL from all images in a post
- Disable posts generated from image uploads
- how to give multiple post thumbnails to a post
- Images showing up in Post Editor, but not in Published Post
- Image behind the post’s title
- How to retrieve certain number of images from a wordpress post?
- Show more than 200 images in one post
- How to get all inline images in post content? [duplicate]
- Hide thumbnail if there is a gallery on the post
- Image on rss feed on post
- Change the background of each post according to the category
- How to Featured content with images in home page?
- Where to insert the other site image url for our wordpress post
- select post preview image from nextgen gallery
- How to show a featured image inside a post in only 1 single category
- Link post images to post
- How to get the next and previous image title from attachment or gallery?
- How to change the order of elements within a post?
- How to call WordPress First Image Post or else Attached Image or Default
- Regarding Posts
- How do I get the image that is submitted with a post, when I’m in the loop?
- How to exclude native lazy loading from first image in post content?
- Rewrite image links from attachment id to attachment link
- Aligning images in the wp editor not working. How do i get this to work in custom theme?
- unable to write to the database while uploading images
- Change the size of the featured image for post?
- Display image gallery if more than 1 image
- How do I fix broken links to images in imported posts’ post_content?
- Post images are not displayed in media library
- Delete attached images from posts
- Blog featured images disappeared on my homepage
- Center crop the feature image
- Schedule image post on download
- Add another feature image box
- ‘posts’ table should not store the absolute image path
- How to show category image if no featured image is set?
- How to make an image appear as a thumbnail in the blog post?
- Set featured image on creating new post
- Manipulating images inside post content
- How can I alternate styling of images in a post? [closed]
- Customizing individual images on posts
- Stop images from being displayed on the front-end of the site
- Update all images url imported from HTML pages
- Featured Images link to post parent
- WP Gallery Image Page Issue When 2 galleries share one image
- Post thumbnail dependant on category
- Latest news mini images
- Why can’t I see my attachment page information for an image?
- How would I attach media/images to a post based on a ID stored in a each post’s custom field
- How do I insert a custom field in a user submitted post?
- Only show posts with image and the correct ammount of posts in loop
- Extra Theme – Fit image inside of Featured Post Slider
- Post thumbnail height problem
- Get attachment if matches a variable
- Is there any SEO impacts on unattached vs attached images for a post in WordPress?
- Full width images within post content
- Broken images after importing posts and opening in Gutenberg
- Search doesn’t display posts with images
- Displaying all images from a WordPress post (including media library)
- How to move all images in a post to a single gallery for a bunch of posts?
- Inside post image title has been posting as a post title on my main post page
- website images getting corrupt automatically
- Optimize blog that serves hundred of images and videos
- Images and menu links disapearing after saving
- Redirection – bulk edit 404s to new tomain
- WordPress portfolio posts: media not displaying if several images