Welcome Guest, Not a member yet? Register   Sign In
image files from javascript
#1

Greetings, 

I'm continuing some existing projects referencing images via Javascript files e.g.
var images=["<img src='/images/chicken.png'>","<img src='[b]/images/pig.png'>"][/b]
Is it possible to reference these directly from Javascript files located in the assets folder i.e. C:\xampp\htdocs\game\assets\images just for demo purposes, not best practice.
 Cheers
Reply
#2

Always use the base_url() setting:
Code:
<img src="<?= base_url('assets/images/pig.png');?>" />
Reply
#3

(This post was last modified: 07-31-2021, 02:12 AM by MARKRONSON.)

hey @Wouter60,
thanks for your suggestion. i was also looking for a for the same. your response was helpful for me.
best regards!!
Reply
#4

cheers wouter
Reply




Theme © iAndrew 2016 - Forum software by © MyBB