Welcome, Guest
Username: Password: Remember me

TOPIC: Image Loading

Image Loading 02 Sep 2013 07:06 #10942

  • blue-canoe
  • blue-canoe's Avatar
  • Offline
  • Senior Member
  • Posts: 57
  • Thank you received: 16
  • Karma: 7
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
The administrator has disabled public write access.

Image Loading 03 Sep 2013 02:38 #10949

  • vlemos
  • vlemos's Avatar
  • Online
  • Elite Member
  • Posts: 295
  • Thank you received: 41
  • Karma: 21
Misha, does it work if the backend logged-in profile is different from the frontend logged-in one? v...
The administrator has disabled public write access.

Image Loading 03 Sep 2013 09:34 #10953

  • blue-canoe
  • blue-canoe's Avatar
  • Offline
  • Senior Member
  • Posts: 57
  • Thank you received: 16
  • Karma: 7
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.
The administrator has disabled public write access.

Image Loading 04 Sep 2013 09:56 #10965

  • blue-canoe
  • blue-canoe's Avatar
  • Offline
  • Senior Member
  • Posts: 57
  • Thank you received: 16
  • Karma: 7
Anybody any idea? For sure it must be something straightforward, but can't seem to find it...
The administrator has disabled public write access.

Image Loading 05 Sep 2013 09:43 #10982

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
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
The administrator has disabled public write access.

Image Loading 05 Sep 2013 12:42 #10996

  • blue-canoe
  • blue-canoe's Avatar
  • Offline
  • Senior Member
  • Posts: 57
  • Thank you received: 16
  • Karma: 7
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
                ));
            ?>
The administrator has disabled public write access.

Image Loading 05 Sep 2013 13:20 #10999

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
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
The administrator has disabled public write access.

Image Loading 06 Sep 2013 05:55 #11010

  • blue-canoe
  • blue-canoe's Avatar
  • Offline
  • Senior Member
  • Posts: 57
  • Thank you received: 16
  • Karma: 7
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>
The administrator has disabled public write access.

Image Loading 07 Sep 2013 17:37 #11022

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
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 administrator has disabled public write access.
The following user(s) said Thank You: blue-canoe

Image Loading 08 Sep 2013 07:55 #11025

  • blue-canoe
  • blue-canoe's Avatar
  • Offline
  • Senior Member
  • Posts: 57
  • Thank you received: 16
  • Karma: 7
Ah that was it. You pointed me in the right direction. For some reason I forgot the 'indirect' => true in my JDom call!

Thanks!
The administrator has disabled public write access.
Time to create page: 0.068 seconds

Get Started