X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl-cms.git;a=blobdiff_plain;f=admin_pages.php;h=382ff5c78e777290c9733baa68405ff3d711dee8;hp=9c7f56aa224e9b3d22ed410ff71e7a6f2405a122;hb=e7424acd48ed670f1b8bd8d7c1ff69b37ce6334b;hpb=c5e948d7d2af9b5e052a7173ebbd8c907e3d6fab diff --git a/admin_pages.php b/admin_pages.php index 9c7f56a..382ff5c 100644 --- a/admin_pages.php +++ b/admin_pages.php @@ -75,22 +75,18 @@ function admin_pages_main_delete($id) { # get all images from admin_images (for cms) function admin_pages_get_images() { $out = []; - $rows = db_get_assocs('cms_images', 'image,name,caption,sizes', 'order by name, caption, image'); + $rows = db_get_assocs('cms_images', 'image,name,caption', 'order by name, caption, image'); if ($rows) { - $id = 0; - foreach($rows as &$row) { + $id = -1; + foreach($rows as &$row) { $id += 1; $parts = explode(' ', $row['image'] . ' ', 7); $out[] = [ 'id' => '' . $id, - 'thumb' => $parts[3], - 'image' => $parts[0], - 'image_width' => (int)$parts[1], - 'image_height' => (int)$parts[2], - 'sizes' => $row['sizes'], + 'src' => $parts[0], + 'aspect' => ''.(round(100000 * ((int)$parts[2]) / ((int)$parts[1]) / 1000)).'%', 'name' => $row['name'], 'caption' => $row['caption'] ]; - $id += 1; } unset($row); } return $out; @@ -172,6 +168,8 @@ function admin_pages_main_form($id = false) { } tem_set('wfpl_images_json', json_encode(admin_pages_get_images())); + tem_set('wfpl_image_width_small', WFPL_IMAGE_WIDTH_SMALL); + tem_set('wfpl_image_width_thumb', WFPL_IMAGE_WIDTH_THUMB); tem_set('form', $data); tem_set('$head'); # wysiwyg init goes in }