‘图片’ 标签下的文章
2009/0325

flickrRSS高阶应用三部曲之新版本flickrRss 5.0补录

分类:wordpress | 发表评论(8 条评论) | 点击量:555次

因为wordpress更新的原因,flickrRSS也相应做了更新,改变了函数参数的编写方式,并加入了更易于配置的html参数。总之,更强大了,使用也更复制了。

我在flickrRSS高阶使用三部曲之二:在WordPress博客中显示与文章内容相关的Flickr图片中提到的在文章后面显示与文章内容相关的flickr图片的功能如果不加以修改是不能使用的。拖了好几个星期,今天因为改了域名(www.shidelai.cn),所以想有个好的开始,把新的代码搞出来了,和原来的效果一样,接近完美。你可以根据我的代码加以修改成自己的代码,比如如果你的页面比较窄,那么可以把’num_items’ => 8修改为’num_items’ => 5等等。

具体方法如下:

flickrRSS高阶使用三部曲之二:在WordPress博客中显示与文章内容相关的Flickr图片

<?php get_flickrRSS(8, “community”, “$first_tag”, “square”, “&nbsp;”, “&nbsp;”); ?>

修改为:

<?php get_flickrRSS(array(’num_items’ => 8, ‘type’ => ‘public’, ‘tags’ => “$first_tag”, ‘html’ => ‘&nbsp;<a href=”%flickr_page%” title=”%title%”><img src=”%image_square%” alt=”%title%”/></a>&nbsp;’)); ?>

就OK了。

参数解释:

The Parameters

‘type’ => ‘user’ – The type of Flickr images that you want to show. Possible values: ‘user’, ‘favorite’, ’set’, ‘group’, ‘public’

‘tags’ => ” – Optional: Can be used with type = ‘user’ or ‘public’, comma separated

’set’ => ” – Optional: To be used with type = ’set’

‘id’ => ” – Optional: Your Group or User ID. To be used with type = ‘user’ or ‘group’

do_cache’ => false – Enable the image cache

‘cache_sizes’ => array(’square’) – What are the image sizes we want to cache locally? Possible values: ’square’, ‘thumbnail’, ’small’, ‘medium’ or ‘large’

‘cache_path’ => ” – Where the images are saved (server path)

‘cache_uri’ => ” – The URI associated to the cache path (web address)

Presentational params

‘num_items’ => 4 – The number of images that you want to display

‘before_list’ => ‘ – The HTML to print before the list of images

‘html’ => ‘<a href=”%flickr_page%” title=”%title%”><img src=”%image_square%” alt=”%title%”/></a>’ – the code to print out for each image.

Meta tags available: %flickr_page%, %title%, %image_small%, %image_square%, %image_thumbnail%, %image_medium%, %image_large%

‘default_title’ => “Untitled Flickr photo” – the default title

‘after_list’ => – the HTML to print after the list of images

Examples

<?php get_flickrRSS(array(’num_items’ => 4, ’type’ => ‘public’, ’tags’ => ’sunflowers’)); ?> – This will display four photos from the public stream that are tagged with sunflowers

<?php get_flickrRSS(array(’set’ => ‘1234567890′, ’num_items’ => 6, ’type’ => ’set’)); ?> – This will display six photos from a specified set

另外可以参考下本站的源码

[相关文章]
2008/1223

不同浏览器里图片大小不同的解决方法

分类:wordpress | 发表评论(2 条评论) | 点击量:748次
不同浏览器里图片大小不同的解决方法

我之前写过flickrRSS高阶使用三部曲之二:在WordPress博客中显示与文章内容相关的Flickr图片,后来发现一个问题:原本图片大小这个参数选择square的话,显示的应该是几张75×75的图片,这在firefox里面一直是正常的,但IE里面就不是这样了,很多图片会被放大,影响总体效果。

前些天偶尔翻CSS手册,看到max-height属性,心想这正好可以解决这个问题。解决方法如下:

修改css文件添加如下代码:

#related-pic img {
max-height:75px;
max-width:75px;
width: expression( this.width> 75 ? “75px” : (this.width+”px”) );
height: expression( this.height> 75 ? “75px” : (this.height+”px”) );
}

意思就是说,在id为related-pic的容器里面,图片(img)的最大宽度和长度是75px,如果发现宽度或长度大于75的,就改成75,如果小于75的就大小不变。

然后在single.php中出现75×75的图片的地方用id为related-pic的容器括进去就可以了:

<b>[相关图片]</b><br />
<div id=”related-pic”>
<?php get_flickrRSS(8, “community”, “$first_tag”, “square”, “&nbsp;”, “&nbsp;”); ?>
</div>

这样,IE的显示就正常了。你当然也可以把上面这段CSS代码这届嵌入到HTML代码里面,如:

<div style=”css code”>
<?php get_flickrRSS(8, “community”, “$first_tag”, “square”, “&nbsp;”, “&nbsp;”); ?>
</div>

类似的, 你也可以设定文章内容中图片的最大宽度,以免不小心用了太大的图,把页面撑得面目全非。

[相关文章]
2008/1001

国庆游记(9月30~10月1)

分类:我的日记 | 发表评论 | 点击量:1093次

经过商量打算一群人去崇明岛玩两天

DSCF0104

国庆去崇明岛的人N多啊,队伍前面还打起架来了

SNV31797

三位MM

[相关文章]
2008/0614

flickrRSS高阶使用三部曲之二:在WordPress博客中显示与文章内容相关的Flickr图片

分类:wordpress | 发表评论(6 条评论) | 点击量:2076次

WordPress插件:显示flickr上的图片-flickrRSS使用详解中我介绍了flickrRSS插件的简单应用,也列举了如何在留言框下面显示flickr上最新发布的标签为:hangzhou的图片。但阿德总感觉这样太单调了,可不可以在这个位置显示与这篇文章内容相关的图片呢?如果可以岂不是太爽了?答案当然是肯定的!要不就不会有这篇博文了,呵呵。:cool:

方法

1. 在打开主题文件夹下的single.php,在

<div class=”post” id=”post-<?php the_ID(); ?>”>

……….

</div><!–/post –>

之间添加如下代码:

[相关文章]