<?php
+
+require_once("include/Photo.php");
+
/**
* @brief Fetches attachment data that were generated the old way
*
$URLSearchString = "^\[\]";
- if (preg_match("/\[img\]([$URLSearchString]*)\[\/img\]/ism", $attacheddata, $matches))
- $post["image"] = $matches[1];
+ if (preg_match("/\[img\]([$URLSearchString]*)\[\/img\]/ism", $attacheddata, $matches)) {
+
+ $picturedata = get_photo_info($matches[1]);
+
+ if (($picturedata[0] >= 500) AND ($picturedata[0] >= $picturedata[1]))
+ $post["image"] = $matches[1];
+ else
+ $post["preview"] = $matches[1];
+ }
if (preg_match("/\[bookmark\=([$URLSearchString]*)\](.*?)\[\/bookmark\]/ism", $attacheddata, $matches)) {
$post["url"] = $matches[1];
$preview = $matches[1];
}
- if (($image == "") AND ($preview != ""))
- $data["image"] = $preview;
- else
+ if ($preview != "")
$data["preview"] = $preview;
$data["description"] = trim($match[3]);