如何将字符串s0-d
替换为-w280-h152-p-k-no-nu
在数据标签data:post.featuredImage
示例:
replace('s0-d', '-w280-h152-p-k-no-nu', data:post.featuredImage);
答案 0 :(得分:1)
在 v2 Blogger模板中,data:post.featuredImage
与Popular Posts小部件相关,我们可以使用预先存在的代码-
<b:with value='data:post.featuredImage.isResizable?resizeImage(data:post.featuredImage, 72, "1:1"):data:post.thumbnail' var='image'>
并修改resizeImage
运算符中存在的宽度和比率参数,以满足我们的要求
<b:with value='data:post.featuredImage.isResizable?resizeImage(data:post.featuredImage, 280, "280:152"):data:post.thumbnail' var='image'>
在 v3 Blogger模板中,直接使用resizeImage
运算符就可以实现目标
<img expr:src='resizeImage(data:post.featuredImage, 280,"280:152")'/>
通常data:post.featuredImage
中使用的snippetedPostThumbnail
数据标签位于b:with
b:includable标签内(此标签有多个实例)。在特定的小部件(例如“特色文章”小部件,“博客文章”小部件等)中进行编辑会影响该特定小部件中的所有图像。使用snippetedPostThumbnail
运算符将resizeImage
b:includable标签的定义中突出显示的<b:includable id='snippetedPostThumbnail'>
<div class='snippet-thumbnail'>
<b:with value='data:post.featuredImage.isYoutube ? resizeImage(data:post.featuredImage.youtubeMaxResDefaultUrl, 945, "945:600") : ""' var='highRes'>
<b:include data='{image: data:post.featuredImage, imageSizes: [256, 512, 945, 1684], imageRatio: "945:600", sourceSizes: "(min-width: 954px) 842px, (min-width: 801px) calc(100vw - 112px), calc(100vw - 64px)", enhancedSourceset: data:highRes}' name='responsiveImage'/>
</b:with>
</div>
</b:includable>
部分替换为先前的图像标签,将具有预期的效果
predictions = model.predict(testData)