skip to Main Content

I am getting some images from clients via a front-end form and uploading those images to the Media Gallery programmatically. The code works fine and uploads the images as intended.

But in the wp-uploads folder it creates copies of these images for all the sizes. I do not want WP to do that only when images are uploaded via this form because just the original image file that the client uploads is sufficient for my need. Could someone please guide me in the right direction? Thank you.

2

Answers


  1. Chosen as BEST ANSWER

    Thanks to a community member, Moshe Gross, the filter to target is

    add_filter('intermediate_image_sizes_advanced', '__return_empty_array');
    

  2. WordPress makes different size images for different uses within the blog, for example, when showing a list of posts it might use a thumbnail next to the article title and so on. You can disable those with 0 values in the resize settings.

    1: Login To Your WP Dashboard.
    2: Go to Settings and then, Media.
    3: Here you will find 3 various image sizes: thumbnail, medium, large.
    4: Decide which image sizes you won’t be using and then set those sizes to 0. Update and save your new settings.

    Please don’t forget to award the final answer to whoever helps. So others can see the solution.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search