Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PHP Extension) Convert Embedded HTML Images to Multipart/Related CID ReferencesDemonstrates how to convert HTML images that are inline/embedded within the HTML to CID references to multipart/related MIME parts. Note: This example requires Chilkat v9.5.0.78 or greater.
<?php // The version number (9_5_0) should match version of the Chilkat extension used, omitting the micro-version number. // For example, if using Chilkat v9.5.0.48, then include as shown here: include("chilkat_9_5_0.php"); // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. // This example converts the following email with image data embedded directly in the HTML, // to the MIME shown at the bottom of this page. // If the HTML contains multiple embedded images, the call to email.ConvertInlineImages will convert all of them. // MIME-Version: 1.0 // Date: Tue, 30 Apr 2019 11:36:34 +0200 // Message-ID: <E5DB5F8A65D671FB4822B22F5309411838F2FC93@PC0VDL0W013> // Content-Type: text/html; charset="windows-1252" // Content-Transfer-Encoding: quoted-printable // X-Priority: 3 (Normal) // From: <admin@chilkatsoft.com> // To: Matt <matt@chilkat.io> // Subject: Test // // <html xmlns=3D"http://www.w3.org/1999/xhtml"> // <body><p> // <img src=3D"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEA3ADcAAD/2= // wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoK= // BggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo= // ... // 4zzS3ww+5/8AyR//2Q=3D=3D" width=3D"58" height=3D"66" alt=3D"" style=3D"bord= // er-width:0px;" /></body> // </html> $email = new CkEmail(); $success = $email->LoadEml('qa_data/eml/embedded_html_image.eml'); $email->ConvertInlineImages(); print $email->getMime() . "\n"; // The MIME after moving the image data to a separate MIME sub-part: // MIME-Version: 1.0 // Date: Tue, 30 Apr 2019 11:36:34 +0200 // Message-ID: <E5DB5F8A65D671FB4822B22F5309411838F2FC93@PC0VDL0W013> // Content-Type: multipart/related; boundary="------------020808080005060904000806" // X-Priority: 3 (Normal) // From: <admin@chilkatsoft.com> // To: Matt <matt@chilkat.io> // Subject: Test // // --------------020808080005060904000806 // Content-Type: text/html; charset=windows-1252 // Content-Transfer-Encoding: quoted-printable // // <html xmlns=3D"http://www.w3.org/1999/xhtml"> // </head></head><body><p> // <img src=3D"cid:CID-1f73052c-32a7-4abb-8e9d-0afb58c17eed@CHILKATSLICE" widt= // h=3D"58" height=3D"66" alt=3D"" style=3D"border-width:0px;" /></body> // </html> // // // // --------------020808080005060904000806 // Content-Type: image/jpeg; name="image_95EA3073134C.jpeg" // Content-Transfer-Encoding: base64 // Content-ID: <CID-1f73052c-32a7-4abb-8e9d-0afb58c17eed@CHILKATSLICE> // // /9j/4AAQSkZJRgABAQEA3ADcAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYF // BgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoK // ... // 5bmGF7e42pOwUxrFNEQOcLGw6vX2Yv7NfxbWLYfB67s84vrf/wCLoor8r424ZwGYZkqlSUk+VLRr // /Jn2mS8QYzC0Woxi9eqf+aGr+zX8XUyW8K9/+f8Ag/8AjlO/4Zs+Ln/Qqf8Ak/b/APxyiivkXwPl // H88/vj/8ifUR4zzS3ww+5/8AyR//2Q== // // --------------020808080005060904000806-- ?> |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.