mardi 20 octobre 2015

wp_get_image_editor not working on some servers

I use wp_get_image_editor for image resizing in my plugin new version so that images resized giving dimensions in plugin's settings page by the user, I read full article for this.

In my older version, I resized images via CSS and they stretched if the images dimensions are not relevant to giving width, height in setting's page. So I use wp_get_image_editor for re-sizing the images.

It's working very perfectly. When the user upgrades from older version to newer version, the user goes to listing page of products, the wp_get_image_editor processes and images are re-sized and move to current month folder with rename image and also saved its meta value in DB with foo_big_image and foo_thumb_image meta keys.

But one of my user is gotten an issue with this, he told me that "when I upgraded from older version to newer version my images are not resizing", so I checked it and I found that foo_big_image and foo_thumb_image meta key values are saved blank in DB and images are not moved into folder ... I also checked in my code and when I print this function wp_get_image_editor it prints me out this error.

WP_Error Object
(
    [errors] => Array
        (
            [invalid_image] => Array
                (
                    [0] => The file is not an image.
                )
        )

    [error_data] => Array
        (
            [invalid_image] => http://ift.tt/1ZTLMQa
        )
)

So I asked the user that are the GD and/or ImageMagick libraries active, he told me that it's not active on my current server so he moved his site to another server where GD and/or ImageMagick libraries are active but it's not re-sizing the images, so I checked the code again and printed the wp_get_image_editor but it shows me the above error.

I search this issue, each and every site tells that it's not working when the libraries are not active.

So please help me where I am doing something wrong ... or the libraries not active yet.

Note: I can not use 'add_image_size()' because I am using meta fields for upload images more than one.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire