SQL Server Stored Procedure Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

SQL Server
Stored Procedure Examples

Quick Start
Encryption
File Access
IMAP
POP3
SMTP
Email Object
DKIM / DomainKey
FTP
HTML Conversion
HTTP
MHT
MIME
NTLM
RSA
Diffie-Hellman
DSA
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
String
Tar
Upload
XML
XMP
Zip

Amazon S3
Bz2
CSV
FileAccess
Byte Array
RSS
Atom
Self-Extractor

Add XMP MetaData to JPG or TIFF

Demonstrates how to add XMP metadata to a JPG or TIFF image that doesn't already have XMP metadata.

CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @xmp int
    EXEC @hr = sp_OACreate 'Chilkat.Xmp', @xmp OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    EXEC sp_OAMethod @xmp, 'UnlockComponent', @success OUT, 'Anything for 30-day trial.'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @xmp, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        RETURN
      END

    DECLARE @xml int

    --  The first step is to create a new XMP document, which is nothing
    --  more than XML.  The NewXmp method returns an XML document with
    --  the standard XMP boilerplate.
    EXEC sp_OAMethod @xmp, 'NewXmp', @xml OUT

    --  Add some properties...
    EXEC sp_OAMethod @xmp, 'AddSimpleStr', @success OUT, @xml, 'Iptc4xmpCore:Chilkat', 'Blah blah'
    --  If you wish to view the XML, save it to a file and review it
    --  with a text editor:
    EXEC sp_OAMethod @xml, 'SaveXml', @success OUT, 'newXmp.xml'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @xml, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        RETURN
      END

    --  To add the XMP to the JPG (or TIFF), simply load the JPG,
    --  append the XMP, and save:
    EXEC sp_OAMethod @xmp, 'LoadAppFile', @success OUT, 'scream.jpg'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @xmp, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        RETURN
      END
    EXEC sp_OAMethod @xmp, 'Append', @success OUT, @xml
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @xmp, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        RETURN
      END
    EXEC sp_OAMethod @xmp, 'SaveAppFile', @success OUT, 'screamOut.jpg'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @xmp, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        RETURN
      END


END
GO

 

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.