<?php
+/* To-Do
+https://developers.google.com/+/plugins/snippet/
+
+<meta itemprop="name" content="Toller Titel">
+<meta itemprop="description" content="Eine tolle Beschreibung">
+<meta itemprop="image" content="http://maple.libertreeproject.org/images/tree-icon.png">
+
+<body itemscope itemtype="http://schema.org/Product">
+ <h1 itemprop="name">Shiny Trinket</h1>
+ <img itemprop="image" src="{image-url}" />
+ <p itemprop="description">Shiny trinkets are shiny.</p>
+</body>
+*/
+
if(!function_exists('deletenode')) {
function deletenode(&$doc, $node)
{
if (($photodata[0] > 150) and ($photodata[1] > 150)) {
if ($photodata[0] > 300) {
- $photodata[1] = $photodata[1] * (300 / $photodata[0]);
+ $photodata[1] = round($photodata[1] * (300 / $photodata[0]));
$photodata[0] = 300;
}
if ($photodata[1] > 300) {
- $photodata[0] = $photodata[0] * (300 / $photodata[1]);
+ $photodata[0] = round($photodata[0] * (300 / $photodata[1]));
$photodata[1] = 300;
}
$siteinfo["images"][] = array("src"=>$src,
}
} else {
$src = completeurl($siteinfo["image"], $url);
+
+ unset($siteinfo["image"]);
+
$photodata = getimagesize($src);
if (($photodata[0] > 10) and ($photodata[1] > 10))
$siteinfo = parseurl_getsiteinfo($url);
if($siteinfo["title"] == "") {
- echo print_r($siteinfo, true);
- //echo sprintf($template,$url,$url,'') . $str_tags;
+ echo sprintf($template,$url,$url,'') . $str_tags;
killme();
} else {
$text = $siteinfo["text"];
$image = "";
- foreach ($siteinfo["images"] as $imagedata)
+ if(sizeof($siteinfo["images"]) > 0){
+ /*
+ Execute below code only if image is present in siteinfo
+ */
+ foreach ($siteinfo["images"] as $imagedata)
if($textmode)
- $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]';
+ $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]';
else
- $image .= '<img height="'.$imagedata["height"].'" width="'.$imagedata["width"].'" src="'.$imagedata["src"].'" alt="photo" />';
-
-/* if ($image != "") {
- $i = fetch_url($image);
- if($i) {
- require_once('include/Photo.php');
- // guess mimetype from headers or filename
- $type = guess_image_type($image,true);
-
- $ph = new Photo($i, $type);
- if($ph->is_valid()) {
- if($ph->getWidth() > 300 || $ph->getHeight() > 300) {
- $ph->scaleImage(300);
- $new_width = $ph->getWidth();
- $new_height = $ph->getHeight();
- if($textmode)
- $image = $br . $br . '[img=' . $new_width . 'x' . $new_height . ']' . $image . '[/img]';
- else
- $image = '<br /><br /><img height="' . $new_height . '" width="' . $new_width . '" src="' .$image . '" alt="photo" />';
- } else {
- if($textmode)
- $image = $br.$br.'[img]'.$image.'[/img]';
- else
- $image = '<br /><br /><img src="'.$image.'" alt="photo" />';
- }
- }
- }
- }*/
+ $image .= '<img height="'.$imagedata["height"].'" width="'.$imagedata["width"].'" src="'.$imagedata["src"].'" alt="photo" />';
+ }
if(strlen($text)) {
if($textmode)