No Thumbnails for Custom Picture Library Definition

 

 

No Thumbnails for Custom Picture Library Definition

I’ve got a Custom Picture Library definition – it encapsulates much of the same functionality I described a few days ago for Document Libraries. I built it, then ran Solution Generator against it to create the List definition and schema.

It all seemed to work alright, but when I tried uploading an image, it didn’t create my thumbnails, or the _w and _t folders the thumbnails are hidden in! This was a problem.

Well, I cracked open reflector (how did we do .NET development before it?) and dug around. Didn’t find much, except that the Upload.aspx page decides if it is for a Picture Library based on the List Template’s Type attribute (ordinarily 109).

The Type attribute of a List Template tag says this:

Provides a unique identifier for the template. This identifier must be unique within the feature, but need not be unique across all feature definitions or site definitions.

This attribute corresponds to the Type attribute of the List element

Hmm. Interesting. I had changed my List Template’s Type – I’ve been keeping all of mine unique in my solution, as I do have multiple lists based on the same out-of-box type (e.g. multiple lists based upon the ‘Custom List’ type).  As I was suspicious, I changed this back to 109, and tried again. My thumbnails now worked.

I guess that this mean that the thumbnailing done during the upload process is contingent on the list’s Type being 109 still. As a consequence, I guess that a feature can only have one custom Picture Library definition (as “This identifier must be unique within the feature”).

5 Comments so far

  1. Jeroen Van Bastelaere on May 25th, 2009

    Hi,

    If you really want to you can create an event receiver and make the logic yourself of creating a thumbnail inside _w and _t.
    I have encountered this same problem a while back and this also works.

    Regards,
    Jeroen

  2. Andy on May 26th, 2009

    Hi Jeroen,

    Yup, that’s a good approach. I prototyped it a while back, and it worked okay. I’d just sooner avoid reinventing the wheel if I can. I’ll just use 109 for now!

  3. Matt on July 6th, 2009

    I did the same thing as you but when I remove the feature it messes up the ability of sharepoint to run the site manager saying feature xxx-xx-x-xx for list template 109 is not installed on this farm.

    Any thoughts about that issue?

    Error goes something like this: “Feature ‘bbc8d48a-6fe9-493d-a035-0f7cdfc1377f’ for list template ‘109′ is not installed in this farm. The operation could not be completed. at Microsoft.SharePoint.SPFeatureManager.GetFeatureRootAndListSchemaPaths(Guid featid, Int32 ltid, String& sPathToFeatureRoot, String& sPathToSchemaXml)”

  4. Jens on October 20th, 2009

    Hi!

    I have this problem, and changing back to type=109 would do it. But what if you have a custom action in your picture library that you only want on your custom list defintion?
    Any ideas?

  5. Andy on October 21st, 2009

    Hmm. That’s a good question. It looks like it might not be possible as a CustomAction.

    I’d be delighted to hear if you find a solution, though.

转载于:https://www.cnblogs.com/Jeffer/archive/2009/11/26/1611625.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
如果您想要为Java中的图像生成缩略图,可以使用Java自带的ImageIO和BufferedImage类来实现。下面是一个简单的Java代码示例,可以将指定图像文件大小的缩略图保存到指定位置: ``` import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; public class ThumbnailGenerator { public static void main(String[] args) throws IOException { // 读入原始图像文件 BufferedImage originalImage = ImageIO.read(new File("original.jpg")); // 计算缩略图的宽度和高度 int thumbnailWidth = 100; int thumbnailHeight = (int) (originalImage.getHeight() * ((double) thumbnailWidth / originalImage.getWidth())); // 创建缩略图 BufferedImage thumbnailImage = new BufferedImage(thumbnailWidth, thumbnailHeight, BufferedImage.TYPE_INT_RGB); thumbnailImage.createGraphics().drawImage(originalImage.getScaledInstance(thumbnailWidth, thumbnailHeight, java.awt.Image.SCALE_SMOOTH), 0, 0, null); // 保存缩略图到指定位置 ImageIO.write(thumbnailImage, "jpg", new File("thumbnail.jpg")); } } ``` 在上面的示例中,我们首先使用ImageIO读取原始图像文件,然后根据指定的缩略图宽度计算缩略图的高度。接下来,我们使用BufferedImage类创建一个缩略图,并将原始图像缩放到缩略图大小。最后,我们使用ImageIO将缩略图保存到指定位置。 注意:在实际应用中,您可能还需要处理缩略图的质量、格式等方面的问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值