Page 1 of 1

Product images are hosted, HELP!

Posted: Fri Dec 03, 2010 10:31 pm
by rewardchain
My products are bulk imported and the product images need to reference a hosted location. On some of the product pages, the hosted imgaes show just fine. For example, use [url]http:/content.hostedsource.com/Large/11391790.jpg[/url] as the Standard Image path. If you then click on the details of the product the image is the red x. The url for that red x is a combo of the site domain and the appended URL ,http://mysite.com/content.hostedsource. ... 391790.jpg.

After looking at the Show Product 1 scriptlet and the ProductImage.ascx.cs I have determined that this page wants to use the \Products folder to load product images. What is the best way to ignore the local drive and just use the image URl?

Here is the code I am referencing :

Code: Select all

phProductImage.Controls.Add(new LiteralControl("<img id=\"ProductImage\" src=\"" + Page.ResolveClientUrl(imageUrl) + "\" border=\"0\" alt=\"" + Server.HtmlEncode(imageAltText) + "\" />"));
Thanks,

Jason

Re: Product images are hosted, HELP!

Posted: Fri Dec 03, 2010 11:29 pm
by WebDev7
I dont know if this would work: try to debug (ImageURL) parameter, tweak the string to reflect your hosted company?

Re: Product images are hosted, HELP!

Posted: Sat Dec 04, 2010 6:52 am
by mazhar
instead of

Code: Select all

phProductImage.Controls.Add(new LiteralControl("<img id=\"ProductImage\" src=\"" + Page.ResolveClientUrl(imageUrl) + "\" border=\"0\" alt=\"" + Server.HtmlEncode(imageAltText) + "\" />"));
try to use this code block

Code: Select all

phProductImage.Controls.Add(new LiteralControl("<img id=\"ProductImage\" src=\"" + ((imageUrl.StartsWith("~/"))?Page.ResolveClientUrl(imageUrl):imageUrl) + "\" border=\"0\" alt=\"" + Server.HtmlEncode(imageAltText) + "\" />"));
and see if it works

Re: Product images are hosted, HELP!

Posted: Sat Dec 04, 2010 10:33 pm
by rewardchain
Mazhar, Thanks for the reply. Unfortunately, it didn't work. I am thinking it could be something with Page.ResolveClientUrl