title: WordPress ACF absolute crop
body: <p>On my front page I want to display a grid with different images. To make it easy to change these images, I'm using Advanced Custom Fields. However it doesn't work to really crop these images. I have put the following code in my template file:</p>
  
  <pre><code>&lt;?php 
  $image = get_field('bild7');
  if( !empty($image) ): 
  // vars
  $url = $image['url'];
  $title = $image['title'];
  $alt = $image['alt'];
  $caption = $image['caption'];
  // thumbnail
  $size = 'bones-thumb-260';
  $thumb = $image['sizes'][ $size ];
  $width = $image['sizes'][ $size . '-width' ];
  $height = $image['sizes'][ $size . '-height' ];
  if( $caption ): ?&gt;
  </code></pre>
  
  <p>In my functions.php:</p>
  
  <pre><code>// Thumbnail sizes
  add_image_size( 'bones-thumb-1040', 1040, 350, true );
  add_image_size( 'bones-thumb-520', 520, 350, true );
  add_image_size( 'bones-thumb-260', 260, 350, true );
  
  add_filter( 'image_size_names_choose', 'bones_custom_image_sizes' );
  
  function bones_custom_image_sizes( $sizes ) {
      return array_merge( $sizes, array(
          'bones-thumb-1040' =&gt; __('1040px by 350px'),
          'bones-thumb-520' =&gt; __('520px by 350px'),
          'bones-thumb-260' =&gt; __('260px by 263px'),
      ) );
  }
  </code></pre>
  
  <p>My custom field is created as image, with the bones-thumb-260 size. You can see the result here: <a href="http://irene-hofer.ch/fortress/" rel="nofollow">http://irene-hofer.ch/fortress/</a></p>