[resolved] Using add_image_size With Magic Fields (5 posts)

  1. johnnyrokkit
    Posted 5 years ago #


    How would I go about pulling a specific custom image size from an image in a Field?

    For instance, I'd like to use Magic Fields to upload a "Logo", an "Image1" and "Image2" -- and I am using the WordPress add_image_size function to create multiple sizes of each uploaded image for use on different parts of the site.

    Assuming I have two custom sizes defined "image-size-small" and "image-size-large", how would I for instance, pull "image-size-large" of the image "Image1" and then pull "image-size-small" from "Image2"?

    Much gratitude and thanks in advance.

  2. hunk
    Posted 5 years ago #

    use get_image http://wiki.magicfields.org/doku.php?id=front-end_functions#get_image or gen_image http://wiki.magicfields.org/doku.php?id=front-end_functions#gen_image.

    check the override_params in get_image and "param" in gen_image

  3. johnnyrokkit
    Posted 5 years ago #

    thanks for the reply!

  4. dermotholmes
    Posted 5 years ago #

    Would anyone be able to provide an example of how to do this?

    Looking at the get_image() override params, the only one that seems like it would work for this would be to use the 'src' override to reference the correct size you want by splicing the correct file name suffix in, is this the intention of how to do this?

    It would be fantastic to use the name of the size, such as johny's "image-size-small" above if possible.

    Is this possible?

  5. dermotholmes
    Posted 5 years ago #

    Never mind, this functionality has now been added as of Magic Fields 1.5.5.

    You can now give get_image() a parameter to pick the native wordpress image size/media size such as "media" etc

Topic Closed

This topic has been closed to new replies.

About this Topic