Page 1 of 1
[solved] CGBlog Additional Fields file_location?
Posted: Sat Jun 06, 2015 11:44 pm
by rbaby
I added an additional field to CGBlog for just an image upload but when I upload it...I can't find the actual file.
All that appears is a broken image with the path as /filename.jpg so it doesn't appear to be finding the file_location and actually uploading the file. Is there a configuration setting I am missing somewhere?
Thank you in advance.
Re: CGBlog Additional Fields file_location?
Posted: Sun Jun 07, 2015 2:31 am
by Jeff
I have you verified if the images is uploaded?
check the default template, cg usually has a $entry->file_location variable that is suppose to be in front field call.
Re: CGBlog Additional Fields file_location?
Posted: Sun Jun 07, 2015 2:45 am
by rbaby
Jeff wrote:I have you verified if the images is uploaded?
check the default template, cg usually has a $entry->file_location variable that is suppose to be in front field call.
Hi Jeff,
The file can't be found anywhere, not in root, not in uploads/images. This is what I have in my template that's showing the broken image:
Code: Select all
{if isset($entry->fields)}
{foreach from=$entry->fields item='field'}
<div class="CGBlogSummaryField">
{if $field->type == 'file'}
<img src="{$entry->file_location}/{$field->value}"/>
{else}
<img src="{$entry->file_location}/{$field->value}"/>{$field->name}: {eval var=$field->value}
{/if}
</div>
{/foreach}
{/if}
I also tried:
Code: Select all
{if !empty($entry->fieldsbyname.Image->value)}
<a href="{$entry->detail_url}"><img src="{$entry->file_location}/{$entry->fieldsbyname.Image->value}" width=100px /></a>
{/if}
Re: CGBlog Additional Fields file_location?
Posted: Sun Jun 07, 2015 2:58 am
by Jeff
Paste the contents of <pre>{$entry|@print_r}</pre>
The files are typically uploaded to /uploads/cgblog/cgblog_{$cgblog_id}/ or something like that.
Can you post the url?
Re: CGBlog Additional Fields file_location?
Posted: Sun Jun 07, 2015 3:31 am
by rbaby
Jeff wrote:Paste the contents of <pre>{$entry|@print_r}</pre>
The files are typically uploaded to /uploads/cgblog/cgblog_{$cgblog_id}/ or something like that.
Can you post the url?
Code: Select all
stdClass Object
(
[author] => author
[id] => 1
[title] => Test Blog Entry
[content] =>
This is blog content.
[summary] =>
[postdate] => 2015-06-06 13:24:00
[url] =>
[startdate] => 2015-06-06 13:24:00
[enddate] =>
[create_date] => 2015-06-06 13:25:07
[modified_date] => 2015-06-06 16:17:02
[categories] => Array
(
[0] => Array
(
[id] => 1
[name] => General
)
[1] => Array
(
[id] => 2
[name] => Training
)
[2] => Array
(
[id] => 3
[name] => In The Peloton
)
[3] => Array
(
[id] => 4
[name] => Cross Train
)
)
[categorylist] => Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
)
[fields] => Array
(
[Image] => stdClass Object
(
[name] => Image
[type] => image
[value] => blog.jpg
)
)
[fieldsbyname] => Array
(
[Image] => stdClass Object
(
[name] => Image
[type] => image
[value] => blog.jpg
)
)
[detail_url] => http://www.domain.com/cyclesense365/1/Test-Blog-Entry
)
1
I found the image blog.jpg, it was in the directory you mentioned--but why isn't it displaying the image with the proper path?
Re: CGBlog Additional Fields file_location?
Posted: Mon Jun 08, 2015 6:21 pm
by rbaby
Jeff wrote:Paste the contents of <pre>{$entry|@print_r}</pre>
The files are typically uploaded to /uploads/cgblog/cgblog_{$cgblog_id}/ or something like that.
Can you post the url?
Is there a way I can just hard code the path? I just don't know how to pass the blog ID for the folder ID.
Re: CGBlog Additional Fields file_location?
Posted: Mon Jun 15, 2015 6:55 am
by rbaby
For those who might be running into the same issue, I found a solution here:
http://dev.cmsmadesimple.org/bug/view/9933
<img src="{uploads_url}/cgblog/id{$entry->id}/{$field->value}"/>