I have a jQuery slider that is fed by HTML imgs, which is iterates. I am trying to create a script in a controller that will grab the images in a certain directory and return an array which I will then decorate with the HTML and send to the view to be ECHOed via iterating the array.
I am trying to use CFileHelper and I have the following code…
I am currently developing this on local host, and the URL for the file being brought back is c:\xampp\htdocs… etc. Will this be any issue at all when moved to a public server? I would imagine not?
I have figured it all out except for one thing - the array of files it is bring back I am echoing as src inside img tags. However, it is bringing back back an array with a path separator of "\" instead of "/". Is there any way to sort this at the route? Or do I just need to substitute in string as required when I iterating it in the view?
BTW I assume the reason for the issue is that either "/" or "\" is accepted by PHP where as HTML rendering will only accept "/"?
Does that even work? The files should be uploading to a protected location. You’d need to copy them to a web accessible location to be able to access them by URL. Having moved them to a web accessible location, you’d use baseUrl or an equivalent to product a URL with the correct path separator.
For storing images? PHP will initially save it to a temporary folder on the file system. If you want it to be accessible, you should save it to a web accessible location. If you want it to be protected, you should save it to somewhere like protected/images.