function image_dimensions($image) { $identify = path_to('identify'); $command = "{$identify} -format '%wx%h' " . escapeshellarg($image); $dimensions = rtrim(`{$command}`); if ($dimensions == '') { return false; } else { return $dimensions; } }
function link_to($params) { $href = path_to(array($params[0])); $attr = ''; if (isset($params['style'])) { $attr .= ' style="' . $params['style'] . '" '; } //TODO: проверка на класс error if (isset($params['class'])) { $attr .= ' class="' . $params['class'] . '" '; } if (isset($params['id'])) { $attr .= ' id="' . $params['id'] . '" '; } if (isset($params['attr'])) { $attr .= ' ' . $params['attr'] . ' '; } return '<a href= "' . $href . '" ' . $attr . '>' . $params[1] . '</a>'; }