Get and use uploads_path in a template

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
User avatar
webform
Power Poster
Power Poster
Posts: 526
Joined: Sat Nov 25, 2006 3:39 pm

Get and use uploads_path in a template

Post by webform »

Is it possible to get and use the uploads_path (/var/www/domain.com/uploads) in a template or do i need to hard code it?

I'm trying to use getimagesize($item->image) in a template but I can't use {uploads_url} as i get no output. If i hardcode the uploads_path instead i get a result for getimagesize.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1829
Joined: Wed Feb 25, 2009 4:25 am

Re: Get and use uploads_path in a template

Post by DIGI3 »

I'm guessing this is LISE, if you look at the default templates they use ->GetImagePath(true), which you could probably adapt.

If you can't get that to work, you can always brute force it:
{$myimagepath = "{uploads_url}/{$item->image}"}
getimagesize($myimagepath)
Not getting the answer you need? CMSMS support options
User avatar
webform
Power Poster
Power Poster
Posts: 526
Joined: Sat Nov 25, 2006 3:39 pm

Re: Get and use uploads_path in a template

Post by webform »

Forgot about ->GetImagePath(true), so i will try it, thanks.

For some reason getimagesize() doesn't work on this host if i use {uploads_url}. But it does work if i use the server uploads path = /var/www/domain.com/uploads/{$item->image}.

Can i get the uploads path from the config in an UDT? I can see in System Information under "CMS Made Simple Config Settings" there is a uploads_path with the required value.
Post Reply

Return to “CMSMS Core”