Support » Plugin: Advanced Custom Fields » [Plugin: Advanced Custom Fields] how to resize upload image?

  • Hi,
    I would like to resize the uploaded image to a thumbnail size 150x 120 to save host bandwidth, especially when uploaded file is huge 3000 x 3000.
    If I don’t resize it, it will take forever to load(when I have 40 to display).

    I was wondering if there is a way to call the thumbnail image url instead of original image.

    Or any alternative way to reduce the size suggestions would greatly appreciated.

    Great plugin, i love it!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey radiofranky,

    You need to know a couple of things first. The names of the image presets in WordPress (I think defaults are Thumbnail, Medium, Large and Full Size). You can always add your own.

    You also need to know the name of the custom field for your image. Try this below (replacing ‘acf image field name’ with your own field name obviously :P).

    <? if(get_field('acf image field name')):
    $attachment_id = get_field('acf image field name');
    echo wp_get_attachment_image( $attachment_id, medium); ?>
    <?php endif; ?>

    This will use the preset ‘medium’ size. Let me know how you get on!



    I tried your code Joff but it is not working.

    get_field(‘acf image field name’) returns the image url, not its id.

    Am I missing something?

    Ahaa…! I’ve found the problem: I missed in the config tab for my image field that you could set the return value to URL or ID…

    Priceless! Thanks so much joffcrabtree

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Advanced Custom Fields] how to resize upload image?’ is closed to new replies.