Problems, need help? Have a tip or advice? Post it here.
19 posts Page 2 of 2
I have been reading this page over and over since morning, copied and played around with this "show_securefile" code and I'm getting nothing out of it.
Code: Select all
<cms:show_securefile 'avatar'>
<cms:dump/>
</cms:show_securefile>

Is yielding nothing, no matter what page I try it on. :(
---
You live many times, but only ever remember your lives.length - 1
---
Image
Hi Simmons,

Are you sure you are using the code in 'context' of the 'avatar' region i.e.
1. either in any 'page-view' of the template containing the securefile
2. or explicitly creating the context of a particular page like this -
Code: Select all
<cms:pages masterpage='some-template.php' page_name='some-page' >
   <cms:show_securefile 'avatar'>
      ..
   </cms:show_securefile>
<cms:pages>

As a confirmatory text, if you can access the other variables of the particular page e.g. using <cms:show k_page_title />, you should be able to access the securefile field as well using cms:show_securefile.

Hope this helps.
Hi,

I have the same problem, no mater what i do nothing will show.

The code in index.php (member section)

Code: Select all
<cms:template clonable='1' title='Members'>

    <cms:member_define_fields />
   
    <cms:editable
    name='imagefile'
    allowed_ext='png, jpg, jpeg'
    max_size='2048'
    type='securefile'
   
    thumb_width='100'
    show_preview='1'
    use_thumb_for_preview='1'
/>
</cms:template>


The code in profil.php (edit profile page) inside the <cms:form></cms:form> section

Code: Select all
<cms:show_securefile 'imagefile' >
    <cms:if file_is_image >
   <a href="<cms:cloak_url link=file_id />" rel="prettyPhoto">
      <img src="<cms:cloak_url link=file_id  />" />
   </a>
    </cms:if>
</cms:show_securefile>


Please help!
@kimheggen, as i tried to explain in the post just before yours (viewtopic.php?p=14258#p14258), you need to use cms:show_securefile in the proper 'context'.

You have defined the region in index.php and trying to show it in profile.php - obviously it is out of context. If you do want to show the image on profile.php (as opposed to editing it), then wrap it around with cms:pages as follows -
Code: Select all
<cms:pages masterpage=k_member_template id=k_member_id >
   <cms:show_securefile 'imagefile'>
      ..
   </cms:show_securefile>
<cms:pages>   

If, however, as is more probable, you need to allow the user to edit this region, following should be sufficient
Code: Select all
 <cms:input type='bound' name='imagefile' />

Hope it helps.
Hi!

Im using the following code as suggested to display the image:

Code: Select all
<cms:show_securefile 'user_image' >
    <cms:if file_is_image >
   <a href="<cms:cloak_url link=file_id />">
      <img src="<cms:cloak_url link=file_id  />" />
   </a>
    </cms:if>
</cms:show_securefile>


I get however this error message on top of the page (images is showing though):

Deprecated: Non-static method SecureFile::_is_image() should not be called statically in [...]/couch/addons/data-bound-form/securefile.php on line 560 Warning: Cannot modify header information - headers already sent by (output started at [...]/couch/addons/data-bound-form/securefile.php:560) in [...]/couch/cms.php on line 342


Any ideas on what might be wrong?
@klaus, this problem has already been fixed in the version of Couch available at GitHub.

So, you may either use that version (https://github.com/CouchCMS/CouchCMS)
Or, edit the 'couch\addons\data-bound-form\securefile.php' file in your installation and modify the following line (#531) -
Code: Select all
function _is_image( $file_ext ){

to make it as follows -
Code: Select all
static function _is_image( $file_ext ){

Hope it helps.
Gracias!!
hi @KK

I have image in securefile
Code: Select all
               <cms:show_securefile "photo_1">
                  <pre>
                     <cms:dump />
                  </pre>
               </cms:show_securefile>


and have:



Code: Select all
show_securefile:
....
file_ext: jpeg
file_is_image: 1
file_size: 226941


question is: does image secure file has thumbnail?

in admin panel it is, but how to get in front-end side?
solved:
Code: Select all
<cms:show_securefile "photo_1">
<cms:cloak_url link=file_id thumbnail='1' />
</cms:show_securefile>
19 posts Page 2 of 2
cron