mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Better handling for images
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$url = file_get_contents("https://img.youtube.com/vi/" . $_POST['id'] . "/mqdefault.jpg");
|
||||
$url = file_get_contents("https://img.youtube.com/vi/".$_POST['id']."/mqdefault.jpg");
|
||||
|
||||
$image = new Imagick();
|
||||
$image->readImageBlob($url);
|
||||
@@ -10,9 +10,9 @@ $image->blurImage(30,50);
|
||||
|
||||
$output = $image->getimageblob();
|
||||
|
||||
//$image->setImageFormat("jpeg");
|
||||
$image->setImageFormat("jpeg");
|
||||
|
||||
//$image->imageWriteFile (fopen ("/static/images/thumbnails/".$_POST['id'].".jpg", "wb"));
|
||||
file_put_contents ("../static/images/thumbnails/".$_POST['id'].".jpg", $image);
|
||||
|
||||
echo base64_encode($output);
|
||||
?>
|
||||
2
static/dist/frontpage.min.js
vendored
2
static/dist/frontpage.min.js
vendored
File diff suppressed because one or more lines are too long
4
static/dist/main.min.js
vendored
4
static/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -121,15 +121,6 @@ var Nochan = {
|
||||
|
||||
if(Nochan.blob_list[i] !== undefined){
|
||||
//$(".room-namer").css("opacity", 0);
|
||||
var img = new Image();
|
||||
img.src = "/images/thumbnails/"+id+".jpg";
|
||||
|
||||
img.onerror = function(){ // Failed to load
|
||||
console.log("didn't find");
|
||||
};
|
||||
img.onload = function(){ // Loaded successfully
|
||||
console.log("found");
|
||||
};
|
||||
setTimeout(function(){
|
||||
$("#mega-background").css("background", "url(data:image/png;base64,"+Nochan.blob_list[i]+")");
|
||||
$("#mega-background").css("background-size" , "200%");
|
||||
@@ -138,36 +129,39 @@ var Nochan = {
|
||||
//$(".room-namer").css("opacity", 1);
|
||||
},500);
|
||||
}else{
|
||||
|
||||
var img = new Image();
|
||||
img.src = "/images/thumbnails/"+id+".jpg";
|
||||
img.src = "/static/images/thumbnails/"+id+".jpg";
|
||||
|
||||
img.onerror = function(){ // Failed to load
|
||||
console.log("didn't find");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {id:id},
|
||||
url: "/php/imageblob.php",
|
||||
success: function(data){
|
||||
Nochan.blob_list.push(data);
|
||||
//data will contain the vote count echoed by the controller i.e.
|
||||
//$(".room-namer").css("opacity", 0);
|
||||
setTimeout(function(){
|
||||
$("#mega-background").css("background", "url(data:image/png;base64,"+data+")");
|
||||
$("#mega-background").css("background-size" , "200%");
|
||||
$("#mega-background").css("opacity", 1);
|
||||
$("#search").attr("placeholder", list[i][3]);
|
||||
//$(".room-namer").css("opacity", 1);
|
||||
},500);
|
||||
//then append the result where ever you want like
|
||||
//$("span#votes_number").html(data); //data will be containing the vote count which you have echoed from the controller
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
img.onload = function(){ // Loaded successfully
|
||||
console.log("found");
|
||||
$("#mega-background").css("background", "url("+img.src+")");
|
||||
$("#mega-background").css("background-size" , "200%");
|
||||
$("#mega-background").css("opacity", 1);
|
||||
$("#search").attr("placeholder", list[i][3]);
|
||||
};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {id:id},
|
||||
url: "/php/imageblob.php",
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
Nochan.blob_list.push(data);
|
||||
//data will contain the vote count echoed by the controller i.e.
|
||||
//$(".room-namer").css("opacity", 0);
|
||||
setTimeout(function(){
|
||||
$("#mega-background").css("background", "url(data:image/png;base64,"+data+")");
|
||||
$("#mega-background").css("background-size" , "200%");
|
||||
$("#mega-background").css("opacity", 1);
|
||||
$("#search").attr("placeholder", list[i][3]);
|
||||
//$(".room-namer").css("opacity", 1);
|
||||
},500);
|
||||
//then append the result where ever you want like
|
||||
//$("span#votes_number").html(data); //data will be containing the vote count which you have echoed from the controller
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
setTimeout(function(){
|
||||
Nochan.add_backdrop(list, i+1);
|
||||
|
||||
Reference in New Issue
Block a user