Home Forums ACF PRO Image minimum width/height and SVGs Reply To: Image minimum width/height and SVGs

  • Just had a look into it. ACF calls getimagesize() directly. It does not appear that there is a WP function for getting the image size that another plugin could hook into. Digging through WP I see that it also calls getimagesize().

    You’re issue here is with PHP but also that SVG is not an image but an XML file. That being said, you can’t use an image field to upload SVG and expect to be able to restrict the image size.

    I would either use a file field and only allow SVG uploads, or have a condional field to select “SVG” or “Standard Image” and have a different field for each.

    I do not know if this validation can be turned off conditionally based on the file type uploaded. It may be possible…. The validation is done during the upload. You may be able to create an acf/load_field filter for your image field. In your filter somehow detect if a file is currently being uploaded, if so then check to see what type of file it is and if it is an SVG file then to remove any dimension and size requirements for the field. This would cause ACF to skip validating these things.