Contents

QLThumbnailRequestSetImageWithData(_:_:_:)

Sets the response to the thumbnail request to image data saved within the document.

Declaration

func QLThumbnailRequestSetImageWithData(_ thumbnail: QLThumbnailRequest!, _ data: CFData!, _ properties: CFDictionary!)

Parameters

  • thumbnail:

    The thumbnail request object.

  • data:

    The image data, which must be in a format supported by the Image I/O framework (JPG, PNG, and so on). In other words, a content type of kUTTypeImage is assumed. (ImageIO.framework is a subframework of the umbrella Application Services framework.)

  • properties:

    A dictionary of properties. The only property that you can currently specify is kCGImageSourceTypeIdentifierHint; see TP30001066 for information about this property.

Discussion

This function returns the thumbnail as a CFData object containing image data. The document’s application must save this data as part of the document’s data; the generator retrieves it and uses this function to return it to the client. Before you call this function, call QLThumbnailRequestGetMaximumSize(_:) to obtain the maximum allowed size for the thumbnail and resize the image if necessary.

Special Considerations

Thread-safety: This function should be called in the same thread as the thumbnail request is made in; generally, this is the same thread in which the GenerateThumbnailForURL callback was invoked.

See Also

Handling thumbnail requests