Home Forums General Issues Recreating fancybox effect with image ID Reply To: Recreating fancybox effect with image ID

  • Hi Elliot,

    Actually, I realised that I don’t need to work with “ID” at all. Instead, I can use “Object” type and still have a custom size as a thumbnail.

    So what I do now is have a function like this:

    	* Add automatic image sizes
           if ( function_exists( 'add_image_size' ) ) { 
    	add_image_size( 'smallsquare', 45, 45, false ); //false: soft prop crop, true: hard crop

    which creates ‘smallsquare’.

    So I can use ‘smallsquare’ with Object and get done what I wanted like this:

    <a href="<?php the_field('race_website') ?>" target=_new>
    						<img class="race_wiki_img" alt="" src="<?php $image = get_field('race_logo'); echo($image['sizes']['smallsquare']); ?>" />

    A very friendly suggestion, perhaps make this clearer in the docs for future users? The way it is written I got the idea that only predefined sizes can be used with Object, but if you want custom sizes you need to use ID.

    Thanks for the help