diff options
author | Andrew Dolgov <[email protected]> | 2019-08-15 12:14:17 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-08-15 12:14:17 +0300 |
commit | 7f3aa3bdc98f3fd75db11726338d6f9988c84299 (patch) | |
tree | 31fab6272370b2baca45acd3cd96e8cf5dc1aa4b | |
parent | 70265119ef081317b69cc534078868f9c46d1559 (diff) |
use HOOK_ARTICLE_IMAGE to pass correct flavor image to API clients
-rw-r--r-- | init.php | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -24,6 +24,7 @@ class Af_Zz_Api_Resize extends Plugin { $this->cache = new DiskCache("images"); $host->add_hook($host::HOOK_RENDER_ARTICLE_API, $this); + $host->add_hook($host::HOOK_ARTICLE_IMAGE, $this); } private function make_thumbnail($input_filename, $output_filename, $dim_max_x = 600, $dim_max_y = 600, $content_type = "", $force_stamp = false) { @@ -214,6 +215,12 @@ class Af_Zz_Api_Resize extends Plugin { return $url; } + function hook_article_image($enclosures, $content, $site_url) { + $article = $this->hook_render_article_api(["headline" => ["content" => $content]]); + + return ["", "", $article["content"]]; + } + function hook_render_article_api($row) { $need_saving = false; $width = (int) clean($_REQUEST["resize_width"]); |