|
b7c27338e09668661b0cfcc446ad2476
|
problem with asset_url?by dv - Member - 10:09PM, Jun 29, 2008 |
|
Hi!
{{'test.gif' | asset_url | img_tag, "Test1"}}
this expands to:
<img src="http://static1.shopify.com/s/files/1/0014/0332/assets/test.gif" alt="Test1" />
which isn’t the correct URL if i hardcode using the URL given under assets->uploaded files->show original, like this
<img src="http://static0.shopify.com/s/files/1/0014/0332/files/test.gif" alt="Test1"/>
then it works correctly, but i don’t like the idea of hardcoding a lot of images. Why doesn’t the the URL given by asset_url work? |
|
|
asset_url points to the assets inside your theme. To see what I mean, login to your admin area, then click “Assets”. Now click “theme editor” and upload your test.gif file using the “upload new theme asset” link. Now this bit of code will work:
|
|
|
because there are different places where images are stored: 1) in a place called “theme assets” – here are the images that relate to the look of your shop. if you change the theme, they get deleted. this corresponds to the url: 2) in a place called “uploaded files”. here are the images that relate to the content of your site, except for the product images. So these are the ones you upload when you enter a collection description, a blog entry picture, etc. There is no liquid shortcut to access these images, hence your problem. 3) on the product page – this is where you have all the product pictures. The url for this is http://static.shopify.com/s/files/1/shop/number/products/image.gif The way I avoid hardcoding paths is this: In my theme template, I enter the following code: either this, which will give you relative paths: or this, which will give you absolute paths. I don’t know which of these two options is the better, maybe someone else can tell us. Paul would probably know. then you can use the following paths: — Last edited 08:00AM, Jun 30, 2008 |
|
|
thanks, exactly what i needed :)
|
rawsterne
Member
07:38AM, Jun 30, 2008