prepareQuery(); $table = $config->sql_tablename_pictures(); $picpath = $config->picture_storepath(); $fileshortcode = strtolower(trim($func->stripHtml($_REQUEST['s']))); $startpage = strtolower(trim($func->stripHtml($_REQUEST['m']))); $stmt = $pdo->prepare("SELECT p_filename,p_uri FROM $table WHERE p_shortcode=:shortcode LIMIT 1"); $stmt->bindValue(':shortcode', $fileshortcode, PDO::PARAM_STR); $stmt->execute(); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); $filename = trim($rows[0]["p_filename"]); $source = trim($rows[0]["p_uri"]); //$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); //echo "deviceType=$deviceType"; $deviceTypeMobile = $detect->isMobile(); $deviceTypeTablet = $detect->isTablet(); //320x240, 480x320, 800x480, 960x480, 1024x800, and 1024x768 $picQuality = 75; if ($deviceTypeTablet === TRUE){ // we have a tablet device $x = 800; $y = 480; $fontsize = 12; $picQuality = 85; } elseif ($deviceTypeMobile === TRUE){ // we have a mobile device $x = 480; $y = 320; $fontsize = 10; $picQuality = 60; } elseif (strpos($startpage, '1') !== FALSE){ $x = 230; $y = 190; $fontsize = 9; $picQuality = 50; } elseif (strpos($startpage, '2') !== FALSE){ $x = 120; $y = 110; $fontsize = 7; $picQuality = 40; } else { // we have a desktop device $x = 960; $y = 680; $fontsize = 15; $picQuality = 95; } if (!empty($filename)&&strlen($filename)>3&&file_exists("$picpath/$filename")){ $source = str_ireplace("http://","",$source); $textinfo = "Quelle: $source"; if ($service->isValidBot() == 1 ){ $textinfo = "Mehr coole News gibts auf BuzzerStar.com"; } try { $img = new SimpleImage(); $img->load("$picpath/$filename"); $img->text($textinfo,"./library/fonts/delicious.ttf", $fontsize, '#000000', 'bottom left', 0, -10); //$img->resize($x, $y); $img->best_fit($x, $y); //$ext = pathinfo($filename, PATHINFO_EXTENSION); /* if ($imgSrc->checkExtension($filename) == 1){ $extension = $imgSrc->getExtension($filename); $img->output($extension); } else { $img->output('jpg'); } */ $img->output('jpg',$picQuality); //$img->output($ext); } catch(Exception $e) { // echo '' . $e->getMessage() . ''; } } else { $source = "http://www.solidcam.de/spezielle-seiten/fehler-404-seiten-nicht-gefunden/"; $source = str_ireplace("http://","",$source); try { $img = new SimpleImage(); $img->load("/home/wwwbuzzerstar/images/filenotfound.png"); $img->text("Quelle: $source","./library/fonts/delicious.ttf", $fontsize, '#000000', 'bottom left', 0, -10); $img->best_fit($x, $y); //$img->resize($x, $y); $img->output('jpg',$picQuality); } catch(Exception $e) { // echo '' . $e->getMessage() . ''; } } $stmt = null; // doing this is mandatory for connection to get closed $pdo = null; exit(0); ?>