I’m trying to use imgsizer. When I use the hard link, such as
{exp:imgsizer:size src=''http://mysite.com/somefolders/image.jpg''}, it works. But I’d like to use relative links. I tried:
{exp:imgsizer:size src="{site_url}folders/image.jpg"}where global variable {site_url} holds
http://mysite.com/somefolders/I also tried
{exp:imgsizer:size src="{test}" width ="150px"}where this local variable defined on top of the template holds the full hard link which worked. No result. No success either if this link is held in a field. Tried the relative paths without variables or fields as per documentation. With and without the / since it’s unclear in the doc which path is used. With up to …./or /….. in the hope to find out. Nothing. Would someone have the kindness to give me an example which works. Thanks.
A couple of things just ensure it’s nothing simple…
I assume these are just typos from your post (and were correct in the template)…
{exp:imgsizer:size src="{site_url}folders/image.jpg"}should read:
{exp:imgsizer:size src="{site_url}somefolders/image.jpg"}Or, as {site_url} = “http://mysite.com/somefolders/” surely it should be:
{exp:imgsizer:size src="{site_url}image.jpg"}{exp:imgsizer:size src="{test}" width ="150px"}should read:
{exp:imgsizer:size src="{test}" width="150px"}What does the following render?
{exp:imgsizer:size src="{site_url}somefolders/image.jpg" justurl="yes" width="150px"}{exp:imgsizer:size src="/somefolders/image.jpg" justurl="yes" width="150px"}{exp:imgsizer:size src="{site_url}somefolders/image.jpg" width="150px"}
URL={sized}
width={width}
{/exp:imgsizer:size}I expect it’s your path, or possibly the path of the generated resized image. Have you created the sized folder as per the instructions on the plugin?
You said this works:
{exp:imgsizer:size src="http://mysite.com/somefolders/image.jpg"}But does this?
{exp:imgsizer:size src="http://mysite.com/somefolders/image.jpg" width="150px"}If the latter doesn’t work I’d say its the output folder - make sure its been created on the server and is writeable.
Yes, width is taken into account when the link is hard-coded. Also thought problem arose from the path. But when I resize the image contained in the field, it doesn’t work either tho’ the link is correct when I output the content. And there’s nothing but the link in this field.
Hiya,
What do you get if you simply output your image field {test}. Don’t use ImageSizer for a while and just see what just the image custom field variable spits out. It may well have tags surrounding it. If it does then the fix will be nice and easy.
If not then what sort of field is this?
Best wishes,
Mark
So you placed in the tag surrounding all that text yourself?
What type of field are you using to hold the link? Just a standard text field or something else?
One other thing to try is if you said that if you hard-code the whole link then it works, right?
If you use {site_url} then it doesn’t?
I think (If I remember from my usage of the plugin) that it doesn’t work with {site_url} due to parsing order.
Sorry, bit confused by your reply.
Yes, width is taken into account when the link is hard-coded.
So it works with:
{exp:imgsizer:size src="http://mysite.com/somefolders/image.jpg" width="150px"}But when I resize the image contained in the field, it doesn’t work either
Or it doesn’t work with:
{exp:imgsizer:size src="http://mysite.com/somefolders/image.jpg" width="150px"}Can you confirm that the sized folder has been created on your server and has the correct access permissions.
The link entering image sizer maybe correct, but if the output folder for the resized image (that imgsizer creates on the fly) doesn’t exist nothing will be output to your page.
When you said this worked:
{exp:imgsizer:size src="http://mysite.com/somefolders/image.jpg"}I’m guessing (without testing), but that will output the original image path you entered because it’s not resizing anything (nothing specified for width or height).
I think (If I remember from my usage of the plugin) that it doesn’t work with {site_url} due to parsing order.
Just did a test on this and Mark is right, {site_url} won’t work, but obviously going from you root folder will be fine.
Thank you both for your reply. The only 2 lines which output something are either:
{exp:imgsizer:size src="/dsh01/images/uploads/pix/dedwyddjones_lp_bard01.jpg" justurl="yes" width="50px"}or
{exp:imgsizer:size src="/dsh01/{main_image_link}" justurl="yes" height="50px" width="50px"}They both output: /images/sized/dsh01/images/uploads/pix/dedwyddjones_lp_bard01-50pxx50px.jpg.
This makes sense since my EE install is not in the root of the site but in a folder just below it, called /dsh01/. But of course, the folder /dsh01/ gets in the way so the link will not work.
Had assumed I could change the base_path and then get rid of the /dsh01/ folder in the image link. To have something like:
{exp:imgsizer:size src="/{main_image_link}" base_path="/dedwyddjones.com/dsh01/" justurl="yes" height="50px" width="50px"}Tried all kind of variations,i.e. putting base_path before the src, including the folder the website is contained in – that is “/webjonet/dedwyddjones.com/dsh01/”, reducing base_path to “/dsh01/”. No good.
What would you suggest?
Should have repeated that yes, hard-coded link worked from the start. Such as:
{exp:imgsizer:size src="http://dedwyddjones.com/dsh01/images/uploads/pix/my_image.jpg" justurl="yes" height="50px" width="50px"}But links such as below don’t work, tho’ {main_image_link) has the equivalent to the above, i.e. images/uploads/pix/my_image.jpg.
{exp:imgsizer:size src="http://dedwyddjones.com/dsh01/{main_image_link}" justurl="yes" height="50px" width="50px"}Yes, I have two /sized/ folders, one below /images/ the other below /images/uploads/pix/, both 777.
If your first one works with the full path and resize, then that means there’s no path problems for the plugin. So the question is your variable.
How are you creating it? {assign_variable:??}, Templates > Global Variables or is it contained in the image field?
As Mark mentioned before, display it and check the html to ensure there’s no extra tags or anything also being chucked out in the variable.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.