} $image = new RMImage($id); if ($image->isNew()) { images_send_json(array('message' => __('Specified image does not exists', 'rmcommon'), 'error' => 1, 'token' => $xoopsSecurity->createToken())); } $author = new RMUser($image->uid); $original = pathinfo($image->get_files_path() . '/' . $image->file); $dimensions = getimagesize($image->get_files_path() . '/' . $image->file); $mimes = (include XOOPS_ROOT_PATH . '/include/mimetypes.inc.php'); $category_sizes = $cat->getVar('sizes'); $sizes = array(); foreach ($category_sizes as $i => $size) { if ($size['width'] <= 0) { continue; } $tfile = $image->get_files_path() . '/sizes/' . $original['filename'] . '-' . $size['name'] . '.' . $original['extension']; if (!is_file($tfile)) { continue; } $t_dim = getimagesize($tfile); $sizes[] = array('width' => $t_dim[0], 'height' => $t_dim[1], 'url' => $image->get_files_url() . '/sizes/' . $original['filename'] . '-' . $size['name'] . '.' . $original['extension'], 'name' => $size['name']); } $sizes[] = array('width' => $dimensions[0], 'height' => $dimensions[1], 'url' => $image->getOriginal(), 'name' => __('Original', 'rmcommon')); $links = array('none' => array('caption' => __('None', 'rmcommon'), 'value' => ''), 'file' => array('caption' => __('File URL', 'rmcommon'), 'value' => XOOPS_UPLOAD_URL . '/' . date('Y', $image->getVar('date')) . '/' . date('m', $image->getVar('date')) . '/' . $image->getVar('file'))); $links = RMEvents::get()->run_event('rmcommon.image.insert.links', $links, $image, RMHttpRequest::post('url', 'string', '')); // Image data $data = array('id' => $image->id(), 'title' => $image->title, 'date' => formatTimestamp($image->date, 'l'), 'description' => $image->getVar('desc', 'n'), 'author' => array('uname' => $author->uname, 'uid' => $author->uid, 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $author->email, 40), 'url' => XOOPS_URL . '/userinfo.php?uid=' . $author->email), 'medium' => $image->get_by_size(300), 'url' => $image->get_files_url(), 'original' => array('file' => $original['basename'], 'url' => $image->getOriginal(), 'size' => RMFormat::bytes_format(filesize($image->get_files_path() . '/' . $image->file)), 'width' => $dimensions[0], 'height' => $dimensions[1]), 'mime' => isset($mimes[$original['extension']]) ? $mimes[$original['extension']] : 'application/octet-stream', 'sizes' => $sizes, 'links' => $links); $data = RMEvents::get()->run_event('rmcommon.loading.image.details', $data, $image, RMHttpRequest::request('url', 'string', '')); $data['token'] = $xoopsSecurity->createToken(); images_send_json($data); }