Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Image Loading 02 Sep 2013 07:06 #10942

Hi all,

This is probably a simple one. I am working locally on a previously generated component. On the front-end part I know want to use an image in a view. This image is added via Javascript (as it is not always required and dependent on the data loaded).

I created a div with the source using the task 'file' of the component. However, this only seems to work when I am logged in to the back-end as well. When not logged in, it does not display the image and I assume this is because this controller (with the file task) is located at the back-end.
For sure I am missing something/forgot something to do.

Anybody any ideas?

Kind regards,
Misha

Please Log in or Create an account to join the conversation.

Image Loading 03 Sep 2013 02:38 #10949

Misha, does it work if the backend logged-in profile is different from the frontend logged-in one? v...

Please Log in or Create an account to join the conversation.

Image Loading 03 Sep 2013 09:34 #10953

I have not tried that. In my situation I was logged in to the back-end as an admin (in a different tab). In the front-end I was not logged in at all (so a guest). When I logged out from the back-end (or lost the session), the pictures no longer appear on the front-end. For sure a security thing as the file accessed (to generate the image) is in the administrator folder, so it redirects to the login screen.

Please Log in or Create an account to join the conversation.

Image Loading 04 Sep 2013 09:56 #10965

Anybody any idea? For sure it must be something straightforward, but can't seem to find it...

Please Log in or Create an account to join the conversation.

Image Loading 05 Sep 2013 09:43 #10982

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
In the indirect path you are using, remove the 'administrator' word.

That's it.
Indirect images paths can be called both from 'front' and from 'back'

@vlemos : moved topic in ressources for developpers
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Image Loading 05 Sep 2013 12:42 #10996

How would I do that? I just have a JDom call? e.g. as below:
<?php
                echo JDom::_('html.fly.file', array(
                    'attrs' => array('center', 'fit', 'crop'),
                    'dataValue' => $this->item->scc_image,
                    'height' => 25,
                    'indirect' => true,
                    'root' => '[DIR_HSMCATEGORY_IMAGE]',
                    'width' => 25
                ));
            ?>

Please Log in or Create an account to join the conversation.

Image Loading 05 Sep 2013 13:20 #10999

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Is that called from front index.php or back ?

That's the question.
What is the returned url ?
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Image Loading 06 Sep 2013 05:55 #11010

This is called from the front-end from one of the views.

De code it generates is:
<div class="img-zone" style="width:30px;height:30px; overflow:hidden;display:inline-block;"><img width="25px" height="25px" src="/administrator/index.php?option=com_hsm&amp;task=file&amp;size=25x25&amp;attrs=center,fit,crop&amp;path=[DIR_HSMCATEGORY_IMAGE]icon_hs.png" style=""></div>

Please Log in or Create an account to join the conversation.

Image Loading 07 Sep 2013 17:37 #11022

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Is it called from a front view ?

See in JDom :

html.fly.file :
getIndirectUrl()

It is there the link is created.
'administrator' must diseapear from your path.
Coding is now a piece of cake
The following user(s) said Thank You: blue-canoe

Please Log in or Create an account to join the conversation.

Image Loading 08 Sep 2013 07:55 #11025

Ah that was it. You pointed me in the right direction. For some reason I forgot the 'indirect' => true in my JDom call!

Thanks!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.107 seconds

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started