Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Amazon Images Parsing

I am new here dis is my first question please help. (code at the end)

on single product page only one image is in original resolution while others are thumbnails blurred images.

check dis url you will see the problem

https://mychristmasdiscount.com/product/wrangler-mens-13mwz-cowboy-cut-original-fit-jean-6/

using dis code

 public function parseImg()
{
    $img = $this->xpathScalar(".//img[@id='miniATF_image']/@src");
    if (!$img)
    {
        $img = $this->xpathScalar(".//img[@id='landingImage']/@data-old-hires");
        $img = str_replace('._SL1200_.jpg', '._SY300_.jpg', $img);
    }
    if (!$img)
    {
        $img = $this->xpathScalar(".//img[@id='landingImage']/@data-a-dynamic-image");
        if (preg_match('/(https?:\/.+?)"/', $img, $matches))
            return $this->rewriteSslImageUrl($matches[1]);
    }

    if (!$img)
    {
        $img = $this->xpathScalar(".//img[@id='landingImage']/@data-a-dynamic-image");
        $img = str_replace('{"', '', $img);
        $img = str_replace('":[350,350]}', '', $img);
    }

    if (!$img)
        $img = $this->xpathScalar(".//img[@id='landingImage']/@src");
    if (!$img)
    {
        $img = $this->xpathScalar(".//img[@id='imgBlkFront']/@src");
        if (preg_match('/^data:image/', $img))
            $img = '';
    }
    if (!$img)
        $img = $this->xpathScalar(".//img[@id='ebooksImgBlkFront']/@src");
    if (!$img)
        $img = $this->xpathScalar(".//*[@id='fine-art-landingImage']/@src");
    if (!$img)
        $img = $this->xpathScalar(".//*[@class='dv-dp-packshot js-hide-on-play-left']//img/@src");
    if (!$img)
    {
        $img = $this->xpathScalar(".//*[contains(@class, 'imageThumb thumb')]/img/@src");
        $img = preg_replace('/\._.+?\_.jpg/', '.jpg', $img);
    }
    if (!$img)
        $img = $this->xpathScalar(".//*[@id='main-image']/@src");

    return $this->rewriteSslImageUrl($img);
}

public function parseImgLarge()
{
    return str_replace('._SY300_.jpg', '.jpg', $this->parseImg());
}

Comments