jasonknight/woocommerce-json-api

Image Issues

Closed this issue · 3 comments

The images returned when using get_products have the wrong url and base_url.

In the array shown below the url is that of a multisite install, it shouldn't have the multisite name in this case 'merchant', the url is meant to be returned as http://localhost/cartmultisite/wp-content/uploads/sites/2/2013/10/Mens-Athletic-Fit-150x150.jpg instead of http://localhost/cartmultisite/merchant/wp-content/uploads/sites/2/2013/10/Mens-Athletic-Fit-150x150.jpg.

One other thing is that the month arguments is meant to be 6, but it keeps fetching 10. I tried this in a normal WP install and a multisite install and the same value of 10 is being returned.
The url is meant to be http://localhost/cartmultisite/wp-content/uploads/sites/2/2013/06/Mens-Athletic-Fit-150x150.jpg and not http://localhost/cartmultisite/wp-content/uploads/sites/2/2013/10/Mens-Athletic-Fit-150x150.jpg

(
    [file] => Mens-Athletic-Fit-150x150.jpg
    [width] => 150
    [height] => 150
    [mime-type] => image/jpeg
    [url] => http://localhost/cartmultisite/merchant/wp-content/uploads/sites/2/2013/10/Mens-Athletic-Fit-150x150.jpg
)
[featured_image] => Array
(
    [0] => Array
        (
            [id] => 90
            [filename] => T_1_front
            [slug] => t_1_front
            [mime_type] => image/jpeg
            [type] => attachment
            [description] => 
            [caption] => 
            [parent_id] => 0
            [publishing] => inherit
            [path] => 2013/06/T_1_front.jpg
            [metadata] => Array


[url] => http://localhost/cartdemo/2013/06/T_1_front.jpg


[base_url] => http://localhost/cartdemo/wp-content/uploads/2013/10

This should/might be fixed with the latest. Pull and see.

I tried using the latest release, am still getting the same issue.
I tried this on a single and multisite WP install, the issue I specifed initially are still there

The url of the image is now returned as shown below. There is an error in http:///

 [url] => http:///localhost/cartdemo/wp-content/uploads/2013/10/T_1_front-150x150.jpg

Seems the API is passing the current month to the url and not the month the image was uploaded.

Fixed.