public function downloadImage($post_id) {
$post = Post::find($post_id);
$file = public_path()."/uploads/Koala.jpg";
$headers = array('Content-Type' => ' image/jpeg');
return Response::download($file,'Koala.jpg',$headers);
}
If I remove the first line of the function it works.
The only way I found to fix this issue was to modify the code this way:
public function downloadImage($post_id) {
$post = Post::find($post_id);
$file = public_path()."/uploads/Koala.jpg";
$headers = array('Content-Type' => ' image/jpeg');
$response = Response::download($file,'Koala.jpg',$headers);
ob_end_clean();
return $response;
}
title
element from $xml
function value_in($element_name, $xml, $content_only = true) {
if ($xml == false) {
return false;
}
$found = preg_match('#<'.$element_name.'(?:\s+[^>]+)?>(.*?)'.
'</'.$element_name.'>#s', $xml, $matches);
if ($found != false) {
if ($content_only) {
return $matches[1]; //ignore the enclosing tags
} else {
return $matches[0]; //return the full pattern match
}
}
// No match found: return false.
return false;
}
$title = value_in('title', $xml);
async function start() {
try {
fetch("https://dog.ceo/api/breeds/list/all").then(function(response) {
return response.json()
}).then(function(data) {
createBreedList(data.message)
})
} catch (e) {
console.log("There was a problem fetching the breed list.")
}
}
Fetch with async
& await
keywordsasync function start() {
try {
const response = await fetch("https://dog.ceo/api/breeds/list/all")
const data = await response.json()
createBreedList(data.message)
} catch (e) {
console.log("There was a problem fetching the breed list.")
}
}
.slide
document.querySelector('.slide').remove()
Removes all the elements with the specified classdocument.querySelectorAll('.slide').remove()
inset
property in CSS is a shorthand for the following four properties: top
, right
, bottom
and left
.exampleText {
position: absolute;
inset: 10px 30px 60px 40px;
background-color: yellow;
}
Its parent element needs to have position
property with relative
valuediv {
background-color: green;
height: 200px;
position: relative;
color: blue;
}