Revert "Merge branch 'develop' into new_image_presentation"
This reverts commit76f4ba7685
, reversing changes made to733543505b
.
This commit is contained in:
parent
76f4ba7685
commit
8145454707
1 changed files with 28 additions and 3 deletions
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
namespace Friendica\Model;
|
namespace Friendica\Model;
|
||||||
|
|
||||||
|
use DOMDocument;
|
||||||
|
use DOMXPath;
|
||||||
use Friendica\Content\Text\BBCode;
|
use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Content\Text\HTML;
|
use Friendica\Content\Text\HTML;
|
||||||
use Friendica\Core\Hook;
|
use Friendica\Core\Hook;
|
||||||
|
@ -3085,9 +3087,10 @@ class Item
|
||||||
];
|
];
|
||||||
Hook::callAll('prepare_body', $hook_data);
|
Hook::callAll('prepare_body', $hook_data);
|
||||||
// Remove old images
|
// Remove old images
|
||||||
$hook_data['html'] = preg_replace('|(<a.*><img.*>.*</a>)|', '', $hook_data['html']);
|
// $hook_data['html'] = preg_replace('|(<a.*><img.*>.*</a>)|', '', $hook_data['html']);
|
||||||
$grid = self::make_image_grid($hook_data);
|
// $grid = self::make_image_grid($hook_data);
|
||||||
$s = $hook_data['html'] . $grid;
|
// $s = $hook_data['html'] . $grid;
|
||||||
|
$s = $hook_data['html'];
|
||||||
unset($hook_data);
|
unset($hook_data);
|
||||||
|
|
||||||
if (!$attach) {
|
if (!$attach) {
|
||||||
|
@ -3131,6 +3134,27 @@ class Item
|
||||||
return $hook_data['html'];
|
return $hook_data['html'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function removes images at the very end of a post based on the assumption that this images are interpreted
|
||||||
|
* as attachments
|
||||||
|
* @param array $rendered_html
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function cutAttachedImages(array &$rendered_html) {
|
||||||
|
$doc = new DOMDocument();
|
||||||
|
$doc->loadHTML($rendered_html);
|
||||||
|
|
||||||
|
$xpathsearch = new DOMXPath($doc);
|
||||||
|
$nodes = $xpathsearch->query("*");
|
||||||
|
|
||||||
|
return $nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $data
|
||||||
|
* @return string|void
|
||||||
|
* @throws \Friendica\Network\HTTPException\ServiceUnavailableException
|
||||||
|
*/
|
||||||
private function make_image_grid(array &$data)
|
private function make_image_grid(array &$data)
|
||||||
{
|
{
|
||||||
$item = $data['item'];
|
$item = $data['item'];
|
||||||
|
@ -3149,6 +3173,7 @@ class Item
|
||||||
'preview' => $preview_url,
|
'preview' => $preview_url,
|
||||||
'attachment' => $attachment,
|
'attachment' => $attachment,
|
||||||
]);
|
]);
|
||||||
|
// @todo add some fany ai to divide images equally on both columns
|
||||||
if ($count % 2 == 0) {
|
if ($count % 2 == 0) {
|
||||||
$img_tags_fc[] = $img_tag;
|
$img_tags_fc[] = $img_tag;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue