Im using the advanced custom fields crop image plugin on wordpress and I am trying to create a thumbnail with a link to a full size image. Here is my output code:

<a href="<?php echo $image['original_image']['url']; ?>" target="_blank">
<img src="<?php echo $image['url']; ?>" /></a>

Nothing echoes apart from the top dimension of the array, such as $image[‘url’] which works fine. I have no idea why this is not working, but i’m new to PHP.

Here is a dump of the array:

Array
(
    [id] => 2458
    [alt] => 
    [title] => CAD-050 3D VIEW
     => 
    [description] => 
    [mime_type] => image/jpeg
    [url] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW_1200x800_acf_cropped.jpg
    [width] => 1200
    [height] => 800
    [sizes] => Array
        (
            [thumbnail] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-200x200.jpg
            [thumbnail-width] => 200
            [thumbnail-height] => 200
            [medium] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-300x240.jpg
            [medium-width] => 300
            [medium-height] => 240
            [medium_large] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-768x614.jpg
            [medium_large-width] => 768
            [medium_large-height] => 614
            [large] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-1024x819.jpg
            [large-width] => 1024
            [large-height] => 819
            [prop-thumb] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-300x300.jpg
            [prop-thumb-width] => 300
            [prop-thumb-height] => 300
            [icon] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-80x80.jpg
            [icon-width] => 80
            [icon-height] => 80
            [small_image] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-500x500.jpg
            [small_image-width] => 500
            [small_image-height] => 500
            [large_image] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-1200x800.jpg
            [large_image-width] => 1200
            [large_image-height] => 800
        )

    [original_image] => Array
        (
            [id] => 2458
            [alt] => 
            [title] => CAD-050 3D VIEW
             => 
            [description] => 
            [mime_type] => image/jpeg
            [url] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW.jpg
            [width] => 1600
            [height] => 1280
            [sizes] => Array
                (
                    [thumbnail] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-200x200.jpg
                    [thumbnail-width] => 200
                    [thumbnail-height] => 200
                    [medium] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-300x240.jpg
                    [medium-width] => 300
                    [medium-height] => 240
                    [medium_large] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-768x614.jpg
                    [medium_large-width] => 768
                    [medium_large-height] => 614
                    [large] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-1024x819.jpg
                    [large-width] => 1024
                    [large-height] => 819
                    [prop-thumb] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-300x300.jpg
                    [prop-thumb-width] => 300
                    [prop-thumb-height] => 300
                    [icon] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-80x80.jpg
                    [icon-width] => 80
                    [icon-height] => 80
                    [small_image] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-500x500.jpg
                    [small_image-width] => 500
                    [small_image-height] => 500
                    [large_image] => http://scott.local/excel/wp-content/uploads/2017/05/CAD-050-3D-VIEW-1200x800.jpg
                    [large_image-width] => 1200
                    [large_image-height] => 800
                )

        )

)

Read more here: Unable to get value of from PHP image array using ACF Image Crop Plugin


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: