Error displaying images in subdomain using laravel 5.3 - laravel

I have successfully deployed my laravel project to shared hosting (cPanel) and all seems to be working apart from the images. The images stored directly on the server e.g. logo.png don't show up and yet css files in the same public directory show up.
When I try to view the image directly via its URL, I still can't access it and gives me an error of "The image "http://..." cannot be displayed because it contains errors.
Could you please advise? Thanks in advance
Updated:
I have tried several alternatives which work locally but not when I upload.
< img src="/img/logo.png" width="100" />
< img src="{{ asset('/img/logo.png') }}" width="100" />
None of the above works and even when I try to access it via http://sub.domain.com/img/logo.png . It gives the error above

It turns out that the problem wasn't with the RewriteRule but rather the ftp client uploading the images with ASCII format. Laravel doesn't seem to pick those images so I re-ftped them with binary format and everything is working fine.
I hope this can help someone else.

Related

The requested URL /image.jpeg was not found on this server

I've got a Laravel in hosting company and I get this error:
The requested URL /image.jpeg was not found on this server.
This also happens with some CSS and JS files but not all the files. What could be? In my localhost environment everything works fine. Can it be some CPanel configuration that I'm missing?
Thank you :)
The standard way to do this is use asset() function. For example, I have example1.js file that I want to import/include/use in my application, I have to use the following code.
<script src="{{ asset('example1.js') }}" type="text/javascript"></script>
If you want to load image named exampleimage.jpg, You have to use the following code.
<img src="{{ asset('exampleimage.jpg') }}" />
You have to store images, Javascript, and CSS in public folder.
Let me know if it works. According to your question, this is your answer. Let me know if you have any more questions.

Magento Media URL stripping all forward slashes

on a dev box we have noticed in some text attributes the media encased urls eg:
<img src="{{media url="wysiwyg/diagram/bigpool.jpg"}}"/>
are being displayed on the front end as
<img src="{{media url="wysiwyg diagram bigpool.jpg"}}"/>
and obviously breaking the image links. Playing around with {{skin url & {{ base url yields the same results. Any URLs outside of this are working fine.
To clarify it is saving correctly in the database (with slashes) but rendering in the browser without which is breaking the image.
I've also hardcoded the url without the {{media url=""}} and it will render fine.
Has anyone run into this problem before or any ideas on what would be causing this? Google and SE are not being to helpful!
The dev box is running NGINX, hhvm & Magento CE 1.9.2
Cheers.
You can use below code
<?php
$string='<img src="{{media url="wysiwyg diagram bigpool.jpg"}}"/>';
echo $this->helper('cms')->getBlockTemplateProcessor()->filter($string)
?>
This will display proper image as you want.

How do I reference a local file properly?

I'm running Wordpress on WAMP right now and I'm trying to figure out how to correctly reference an image that i'm using in my header for all my pages.
If I write this:
<img src="wp-content/themes/my-theme/images/SSBlogoALPHA.png">
the logo shows up on the WP homepage, but not on any subsequent pages.
If I write
<img src="../wp-content/themes/my-theme/images/SSBlogoALPHA.png">
the logo shows up on all subsequent pages, but not the homepage.
to be honest I don't know what the "../" does or where my root folder is supposed to be when writing a directory path but these are the ways that i've seen other people do this. Any ideas? Thanks!
you can get the images by following way
<img src="<?php bloginfo('template_directory'); ?>/images/SSBlogoALPHA.png" alt=""/>

Route to images and css in Play Framework 2.10

My designer have finished the whole website and I need to make it work using Play 2.10.
The problem is:
All assets are being loaded this way
<img src="images/logo.png" alt="" />
I could not route properly.
I tryied this
GET images/*file controllers.Assets.at(path="/public/images", file)
But the result is
'/' expected but `i' found
How can I route to my assets without rewriting all the urls?
Thanks in advance
Leonardo Rodrigo
The slash is missing, try:
GET /images/*file controllers.Assets.at(path="/public/images", file)

Image display codeigniter fails

I can upload image to the directory but can not disply it on the page.
Tried using static html code and codeigniter img() function, both are not working.
Here is my code:
<image src="./applications/views/uploads/image.jpeg" />
and
$this->output->set_header("Content-Type: image/jpeg");
$data['image'] = $this->load->file('../uploads/taurus.jpeg');
the first code shows me broken image the second one shows Unable to load the requested file: taurus.jpeg
<image src="./applications/views/uploads/image.jpeg" />
By default, CodeIgniter denies access to the application folder which is why I suspect this isn't working.
$this->output->set_header("Content-Type: image/jpeg");
$data['image'] = $this->load->file('../uploads/taurus.jpeg');
I suspect this isn't working because your path is incorrect. The path is relative to the index.php file in the root of your application, not the file this code is in. Secondly, $this->load->file() sends to file contents to the browser so this wouldn't work anyway.
A solution would be to move your uploads folder to a web accessible location. For example, place the uploads folder into the root of your application - the same folder as your index.php file. Then you can display your image like this:
<image src="/uploads/image.jpeg" />
Just get rid of the dot (.) in the URL so your src url reads: "/applications/views/uploads/image.jpeg"

Resources