Commit a8ea2cc2 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed imagesearch layout

parent 98436c52
......@@ -100,12 +100,12 @@ class MetaGer
$this->adDomainsBlacklisted = explode("\n", $tmp);
}
if(file_exists(config_path() . "/adBlacklistUrl.txt")){
if (file_exists(config_path() . "/adBlacklistUrl.txt")) {
$tmp = file_get_contents(config_path() . "/adBlacklistUrl.txt");
$this->adUrlsBlacklisted = explode("\n", $tmp);
}
if(file_exists(config_path() . "/blacklistDescriptionUrl.txt")){
if (file_exists(config_path() . "/blacklistDescriptionUrl.txt")) {
$tmp = file_get_contents(config_path() . "/blacklistDescriptionUrl.txt");
$this->blacklistDescriptionUrl = explode("\n", $tmp);
}
......@@ -172,6 +172,7 @@ class MetaGer
->with('errors', $this->errors)
->with('apiAuthorized', $this->apiAuthorized)
->with('metager', $this)
->with('imagesearch', true)
->with('browser', (new Agent())->browser());
default:
return view('resultpages.resultpage_images')
......@@ -185,6 +186,7 @@ class MetaGer
->with('browser', (new Agent())->browser())
->with('quicktips', $quicktipResults)
->with('focus', $this->fokus)
->with('imagesearch', true)
->with('resultcount', count($this->results));
}
} else {
......@@ -403,7 +405,7 @@ class MetaGer
$arr[$link]->gefVonLink[] = $this->results[$i]->gefVonLink[0];
// The duplicate might already be an adgoal partnershop
if($this->results[$i]->partnershop){
if ($this->results[$i]->partnershop) {
# Den Link hinzufügen:
$arr[$link]->logo = $this->results[$i]->logo;
$arr[$link]->image = $this->results[$i]->image;
......@@ -427,16 +429,17 @@ class MetaGer
* @param Boolean $wait Wait for Results?
* @return Boolean whether or not all Admitad Objects are finished
*/
public function parseAffiliates(&$affiliates){
public function parseAffiliates(&$affiliates)
{
$wait = false;
$finished = true;
if(!$this->javascript){
if (!$this->javascript) {
$wait = true;
}
foreach ($affiliates as $affiliate) {
$affiliate->fetchAffiliates($wait);
$affiliate->parseAffiliates($this->results);
if(!$affiliate->finished){
if (!$affiliate->finished) {
$finished = false;
}
}
......@@ -653,7 +656,7 @@ class MetaGer
{
if ($this->canCache()) {
foreach ($this->engines as $engine) {
if(Cache::has($engine->hash)){
if (Cache::has($engine->hash)) {
$engine->cached = true;
$engine->retrieveResults($this, Cache::get($engine->hash));
}
......@@ -1125,7 +1128,7 @@ class MetaGer
public function createQuicktips()
{
# Die quicktips werden als job erstellt und zur Abarbeitung freigegeben
if (!$this->dummy) {
if (!$this->dummy && $this->getFokus() !== "bilder") {
$quicktips = new \App\Models\Quicktips\Quicktips($this->q, LaravelLocalization::getCurrentLocale(), $this->getTime(), $this->sprueche);
return $quicktips;
} else {
......@@ -1278,7 +1281,7 @@ class MetaGer
}
}
foreach (Cookie::get() as $key => $value) {
if ((stripos($key, $this->fokus.'_blpage') === 0) && (stripos($value, '*.') === false)) {
if ((stripos($key, $this->fokus . '_blpage') === 0) && (stripos($value, '*.') === false)) {
$this->hostBlacklist[] = $value;
}
}
......@@ -1320,7 +1323,7 @@ class MetaGer
}
}
foreach (Cookie::get() as $key => $value) {
if (stripos($key, $this->fokus.'_blpage') === 0 && stripos($value, '*.') === 0) {
if (stripos($key, $this->fokus . '_blpage') === 0 && stripos($value, '*.') === 0) {
$this->domainBlacklist[] = str_replace("*.", "", $value);
}
}
......@@ -1371,7 +1374,7 @@ class MetaGer
$words = preg_split("/\s+/si", $tmp);
$newQ = $this->q;
foreach ($words as $word) {
if(preg_match("/^-[a-zA-Z0-9]/", $word)){
if (preg_match("/^-[a-zA-Z0-9]/", $word)) {
$this->stopWords[] = substr($word, 1);
$newQ = str_ireplace($word, "", $newQ);
}
......@@ -1910,15 +1913,18 @@ class MetaGer
return $this->headerPrinted;
}
public function isDummy(){
public function isDummy()
{
return $this->dummy;
}
public function jsEnabled() {
public function jsEnabled()
{
return $this->javascript;
}
public function setJsEnabled(bool $bool){
public function setJsEnabled(bool $bool)
{
$this->javascript = $bool;
}
/**
......
......@@ -80,28 +80,10 @@ class BingBilder extends Searchengine
{
$url = $result->image;
// all images get cropped to a width of 400 px
// We will calculate the height after cropping
// All Images in a row get 250px
// If the height after cropping is a multiple of that plus the gap between rows
// we will allow the image to span up to three rows
$newWidth = 400;
$newHeight = 250;
$heightMultiplier = 1; // Can be 1..3 in the end
$gapPixels = 8;
$width = $result->imageDimensions["width"];
$height = $result->imageDimensions["height"];
$heightAfterCrop = $height * (400 / $width);
$heightMultiplier = max(1, min(3, floor($heightAfterCrop / 250)));
$newHeight = $newHeight * $heightMultiplier + (($heightMultiplier - 1) * $gapPixels);
$newHeight = 150;
$requestDataBing = [
"w" => $newWidth,
"h" => $newHeight,
"c" => 7, // Smart Cropping
];
$requestDataBing = http_build_query($requestDataBing, "", "&", PHP_QUERY_RFC3986);
......@@ -110,9 +92,6 @@ class BingBilder extends Searchengine
$requestData = [];
$requestData["url"] = $url;
$link = action('Pictureproxy@get', $requestData);
return [
"link" => $link,
"height-multiplier" => $heightMultiplier
];
return $link;
}
}
......@@ -214,21 +214,50 @@ a {
/* Hier der Style für die Bilder */
.image-container {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 8px;
margin-bottom: 16px;
.imagesearch {
#resultpage-container {
grid-template-areas:
"whitespace searchbar"
"whitespace foki"
"whitespace options"
"results results"
"footer footer";
grid-template-columns: minmax(0, 150px) minmax(800px, 1770px);
@media(max-width: 800px) {
grid-template-columns: 0 1fr 0;
grid-template-areas:
"searchbar searchbar searchbar"
"foki foki foki"
"options options options"
"results results results"
"footer footer footer";
}
>.image {
&.height-2 {
grid-row: span 2;
margin: 0;
gap: 0;
#additions-container {
display: none;
}
&.height-3 {
grid-row: span 3;
#options {
margin: 8px 0;
}
#results-container {
max-width: initial;
padding: 8px;
.image-container {
display: flex;
align-items: center;
gap: 16px;
flex-wrap: wrap;
>.image {
flex-grow: 1;
>a {
display: block;
......@@ -239,6 +268,9 @@ a {
}
}
}
}
}
}
}
......
@php
$imageData = \App\Models\parserSkripte\BingBilder::generateThumbnailUrl($result)
@endphp
<div class="image height-{{$imageData['height-multiplier']}}" data-width="{{$result->imageDimensions['width']}}" data-height="{{$result->imageDimensions['height']}}">
<div class="image" data-width="{{$result->imageDimensions['width']}}" data-height="{{$result->imageDimensions['height']}}">
<a href="{{ $result->link }}" target="_blank">
<div title="{{ $result->titel }}">
<img src="{{ $imageData['link'] }}" alt="{{ $result->titel }}" />
<img src="{{ \App\Models\parserSkripte\BingBilder::generateThumbnailUrl($result) }}" alt="{{ $result->titel }}" />
<!--<div>{{ $result->gefVon[0] }}</div>-->
</div>
</a>
......
@if(!$metager->isHeaderPrinted())
<!DOCTYPE html>
<html lang="{!! trans('staticPages.meta.language') !!}">
<head>
<head>
<meta charset="utf-8">
<link href="/favicon.ico" rel="icon" type="image/x-icon" />
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
......@@ -22,16 +23,16 @@
<link href="/fonts/liberationsans/stylesheet.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="{{ mix('css/themes/metager.css') }}"/>
<link type="text/css" rel="stylesheet" href="{{ mix('css/themes/metager.css') }}" />
@if(Cookie::get('dark_mode') === "2")
<link type="text/css" rel="stylesheet" href="{{ mix('css/themes/metager-dark.css') }}"/>
<link type="text/css" rel="stylesheet" href="{{ mix('css/themes/metager-dark.css') }}" />
@elseif(Cookie::get('dark_mode') === "1")
<link type="text/css" rel="stylesheet" href="{{ mix('css/themes/metager.css') }}"/>
<link type="text/css" rel="stylesheet" href="{{ mix('css/themes/metager.css') }}" />
@elseif(Request::input('out', '') !== "results-with-style" )
<link type="text/css" rel="stylesheet" media="(prefers-color-scheme:dark)" href="{{ mix('css/themes/metager-dark.css') }}"/>
<link type="text/css" rel="stylesheet" media="(prefers-color-scheme:dark)" href="{{ mix('css/themes/metager-dark.css') }}" />
@endif
@endif
@endif
<title>{{ $eingabe }} - MetaGer</title>
<meta content="width=device-width, initial-scale=1.0, user-scalable=no" name="viewport" />
<meta name="p" content="{{ getmypid() }}" />
......@@ -41,10 +42,11 @@
<meta name="mn" content="{{ $metager->getVerificationCount() }}" />
<meta name="searchkey" content="{{ $metager->getSearchUid() }}" />
<meta name="referrer" content="origin">
<meta name="age-meta-label" content="age=18"/>
<meta name="age-meta-label" content="age=18" />
@include('parts.utility')
</head>
<body id="resultpage-body">
</head>
<body id="resultpage-body" @if(!empty($imagesearch) && $imagesearch)class="imagesearch" @endif>
@if(Request::getHttpHost() === "metager3.de")
<div class="alert alert-info metager3-unstable-warning-resultpage">
{!! @trans('resultPage.metager3') !!}
......@@ -69,5 +71,6 @@
@include('parts.sidebar-opener', ['class' => 'fixed'])
<script src="{{ mix('js/lib.js') }}"></script>
<script src="{{ mix('js/scriptResultPage.js') }}" defer></script>
</body>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment