本文整理汇总了PHP中td_demo_media::get_image_url_by_td_id方法的典型用法代码示例。如果您正苦于以下问题:PHP td_demo_media::get_image_url_by_td_id方法的具体用法?PHP td_demo_media::get_image_url_by_td_id怎么用?PHP td_demo_media::get_image_url_by_td_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类td_demo_media
的用法示例。
在下文中一共展示了td_demo_media::get_image_url_by_td_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_content_file
private static function parse_content_file($file_path)
{
$file_content = file_get_contents($file_path);
preg_match_all("/xxx_(.*)_xxx/U", $file_content, $matches, PREG_PATTERN_ORDER);
/*
$matches =
[0] => Array
(
[0] => xxx_td_pic_5:300x200_xxx
[1] => xxx_td_pic_5_xxx
)
[1] => Array
(
[0] => td_pic_5:300x200
[1] => td_pic_5
)
*/
if (!empty($matches) and is_array($matches)) {
foreach ($matches[1] as $index => $match) {
$size = '';
//default image size
//try to read the size form the match - NOT USED 29.05.2015
if (strpos($match, ':') !== false) {
$match_parts = explode(':', $match);
$match = $match_parts[0];
$size = explode('x', $match_parts[1]);
//print_r($size);
}
$file_content = str_replace($matches[0][$index], td_demo_media::get_image_url_by_td_id($match, $size), $file_content);
}
}
unset($matches);
preg_match_all("/iii_(.*)_iii/U", $file_content, $matches, PREG_PATTERN_ORDER);
if (!empty($matches) and is_array($matches)) {
foreach ($matches[1] as $index => $match) {
$file_content = str_replace($matches[0][$index], td_demo_media::get_by_td_id($match), $file_content);
}
}
return $file_content;
}