Getting Url From Field Type
Created 6 years ago by richardoctoeyhi guys, I have problems when showing url, I use {{ page.header_image.url }} but the results is: http://localhost:8000/\app/default/files-module/local/images/banner-ourpage.jpg Why I get the backslash in the url? It will be ok if no backslash I'm using windows and pyrocms 3.3
Checkout the comment I left on Stackoverflow too but I wonder if there is a bug somewhere..
Generally though I would personally use {{ page.header_image.route('view') }}
or {{ page.header_image.route('download' }}
for example.
Actually.. I @richardoctoey I just noticed this is not making it into the Image
class which is what I was assuming earlier. It was in the files adapter. Your code was fine but I just realized there was a bug there for windows machines. This should fix it: https://github.com/anomalylabs/local_storage_adapter-extension/commit/151b53be442e1851f2bd8a3b06b84cdbaeef9907
But to echo what @oimken suggested I would lean on paths rather than absolute URLs whenever possible which all the route() method do as does {{ page.header_image.make.path }}
. Note that cause you use make
you are now accessing an image instance: https://pyrocms.com/documentation/streams-platform/latest#services/image
@ryanthompson allright thankyou mate @oimken thanks mate. For thoose who want simple answer may use oimken way
Actually.. I @richardoctoey I just noticed this is not making it into the
Image
class which is what I was assuming earlier. It was in the files adapter. Your code was fine but I just realized there was a bug there for windows machines. This should fix it: https://github.com/anomalylabs/local_storage_adapter-extension/commit/151b53be442e1851f2bd8a3b06b84cdbaeef9907But to echo what @oimken suggested I would lean on paths rather than absolute URLs whenever possible which all the route() method do as does
{{ page.header_image.make.path }}
. Note that cause you usemake
you are now accessing an image instance: https://pyrocms.com/documentation/streams-platform/latest#services/image