Hi i'm tring to include an image on a blade
<tr>
<td><img src="{{public_path().$modelo->imagem}}"></td>
</tr>
But i'm getting this error
ErrorException
getimagesize(): Read error!
/PHPExcel/Worksheet/Drawing.php
public function setPath($pValue = '', $pVerifyFile = true) {
if ($pVerifyFile) {
if (file_exists($pValue)) {
$this->_path = $pValue;
if ($this->_width == 0 && $this->_height == 0) {
// Get width/height
list($this->_width, $this->_height) = getimagesize($pValue);
}
} else {
Do you something about??
You should use <img src="{{$modelo->imagem}}"></td>
So just relative paths.
I have got this message:
PHPExcel_Exception
File not found!
open: /excel/PHPExcel/Worksheet/Drawing.php
$this->_path = $pValue;
if ($this->_width == 0 && $this->_height == 0) {
// Get width/height
list($this->_width, $this->_height) = getimagesize($pValue);
}
} else {
throw new PHPExcel_Exception("File $pValue not found!");
}
This is my blade
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
table tr {
height: 40px;
}
table tr td{
font-size:20px;
}
table tr.header {
height: 60px;
}
table tr.header td{
font-size:40px;
}
table tr td.content{
font-weight: bold;
}
table tr td.first{
}
</style>
</head>
<body>
<table border="1">
<tr class="header">
<td class="first"> Salve Salto </td>
<td colspan="2"> MPJ - Atelier de Amostras </td>
<td colspan="2"> N潞 pedido </td>
</tr>
<tr>
<td><img src="{{$modelo->imagem}}"></td>
</tr>
</body>
This is my method on controller:
$pedido = Pedido::where('id', $id)->first();
Excel::create('Filename', function($excel) use($pedido) {
foreach ($pedido->modelo as $key => $modelo) {
$excel->sheet($modelo->id_modelo, function($sheet) use($modelo) {
$sheet->setOrientation('landscape');
$sheet->loadView('adm.sheet')->with('modelo',$modelo);
});
}
})->export('xls');
Apparently your image {{$modelo->imagem}} does not exist / cannot be found.
The image path should be relative. So something like /assets/img.jpg. So no domains should be in the url (like example.com/assets/img.jpg).
Realy the problem is the path, thanks :)
I have the same problem, i have an image in the path 'public/images/logo.jpg', I'm using the export function with a view, so i have a tag:
<div>
<img src="/images/logo.jpg">
</div>
The laravel console tell me
PHPExcel_Exception
File /images/logo.jpg not found!
How can I solve this problem. Thanks :)
how about removing '/' ?
<div>
<img src="images/logo.jpg">
</div>
still with the same problem :(
Hmmm are u sure the image is exist or the path url is right? Try call your image from browser for make sure
http://example.com/public/images/logo.jpg
See if logo.jpg shown or not?
yes i'm sure that the file exist, i tried with another file and it gives me the same problem :(
You can use <img src="public/images/logo.jpg" />
It's done i've just tried <img src="{{ public_path().'/images/logo.jpg' }}" />
I have a remote image, is it possible?
example
https://d2jnbxtr5v4vqu.cloudfront.net/images/12-2017_10_19_19_43_18.jpg
same problem..... :( how can load a image from external resource
Same here, I need from external resources
It's done i've just tried
<img src="{{ public_path().'/images/logo.jpg' }}" />
It worked for me. Thanks
Most helpful comment
It's done i've just tried
<img src="{{ public_path().'/images/logo.jpg' }}" />