Picasa外链的使用
Thursday, May 14 14:53, 2009
0 comments/558 hits
昨天一直怀疑的picasa外链的问题,原来是因为google为了防止技术不行的人使用滥用图片,所以增加了一些外链的难度,并且使得外链的图片大小收到限制,如下图所示:

原来要在外部链接使用宽度或者高度限定参数(上图中的尺寸指的是高度参数)来限制外链图的大小。参考google web albums的reference guide.
所以,对于原始的图片地址,比如http://*.ggpht.com/*/blogimg.jpg, 可以使用如下的两种方式外链:
另外,经过高人指点我的upload页面变得更加简单高效了。


原来要在外部链接使用宽度或者高度限定参数(上图中的尺寸指的是高度参数)来限制外链图的大小。参考google web albums的reference guide.
所以,对于原始的图片地址,比如http://*.ggpht.com/*/blogimg.jpg, 可以使用如下的两种方式外链:
- http://*.ggpht.com/*/s512/blogimg.jpg
- http://*.ggpht.com/*/blogimg.jpg?imgmax=512
另外,经过高人指点我的upload页面变得更加简单高效了。
@authorized.role("admin")
def post(self):
filename = self.request.get('imgfile')
filetitle = self.request.get('imgtitle')
file_handle = StringIO.StringIO(filename) #convert string to file-like object
gd_client = gdata.photos.service.PhotosService()
gd_client.email = 'gzguoer@gmail.com'
gd_client.password = bbpsw.getpassword()
gd_client.source = 'blowblood-upload-image'
gd_client.ProgrammaticLogin()
album_url = '/data/feed/api/user/gzguoer/albumid/5334765855583692065'
try:
photo = gd_client.InsertPhotoSimple(album_url, 'blogimg',filetitle,
file_handle, content_type='image/jpeg')
img_url = photo.GetMediaURL()+"?imgmax=512"
self.response.out.write('<script type="text/javascript">
window.parent.rteGetImage("%s")</script>' % img_url)
except gdata.service.RequestError:
self.response.out.write(GooglePhotosException)上传完毕之后,直接调用该iframe他爹的javascript函数rteGetImage函数,并且把图片的外链url传输过去,哈哈,然后他爹页面把图片外链url做成一个img标签,嵌入到rich text editor的编辑区域中,并且关闭这个上传页面。哈哈,不错。下面再来一幅nb图像,看看我的摄影技术,哈哈。
Recent Comments