QPx_NewImporterForURL
QPx_NewImporterForURL(importerRef; importerRef):error | |||
---|---|---|---|
![]() |
importerRef | Longint | New graphics importer reference |
![]() |
imageURL | Text | URL to the image |
![]() |
error | Longint | Error result |
Create a graphics importer from a URL
The reference to the importer instance is returned in the importerRef parameter. QPix calls QuickTime to identify the image and create an instance of the proper graphics importer. QuickTime iterates over all available importers, checking the importer type and flags, until it finds an importer that can handle the specified graphics file. If the specified file format is not supported by any importer, importerRef is set to 0 and the qpx_paramErr error code is returned.
This reference can be used with all QPix commands in this group to refer to the graphics importer instance and its associated data.
If imageURL is empty, QPix presents a URL selection dialog where the user can type or paste a URL, or select a recently visited URL from a popup menu. If the user provides a URL, it is returned in imageURL. If the user cancels the dialog, error qpx_userCancelErr is returned.
This command supports QuickTime's http://, ftp://, and file:// URL schemes.
Possible network-related errors:
qpx_urlDataHHTTPProtocolErr | -2129 | HTTP protocol error |
qpx_urlDataHHTTPNoNetDriverErr | -2130 | No network driver for HTTP |
qpx_urlDataHHTTPURLErr | -2131 | URL error |
qpx_urlDataHHTTPRedirectErr | -2132 | HTTP redirection error |
qpx_urlDataHFTPProtocolErr | -2133 | FTP protocol error |
qpx_urlDataHFTPShutdownErr | -2134 | The FTP server has closed the connection |
qpx_urlDataHFTPBadUserErr | -2135 | User name rejected by FTP server |
qpx_urlDataHFTPBadPasswordErr | -2136 | User password rejected by FTP server |
qpx_urlDataHFTPServerErr | -2137 | FTP server error |
qpx_urlDataHFTPDataConErr | -2138 | FTP data connection error |
qpx_urlDataHFTPNoDirectoryErr | -2139 | FTP no directory |
qpx_urlDataHFTPQuotaErr | -2140 | FTP quota error |
qpx_urlDataHFTPPermissionsErr | -2141 | FTP permissions error |
qpx_urlDataHFTPFilenameErr | -2142 | FTP filename error |
qpx_urlDataHFTPNoNetDriverErr | -2143 | No network driver for FTP |
qpx_urlDataHFTPBadNameListErr | -2144 | Bad name in FTP session |
qpx_urlDataHFTPNeedPasswordErr | -2145 | Password error in FTP session |
qpx_urlDataHFTPNoPasswordErr | -2146 | Password error in FTP session |
qpx_urlDataHFTPServerDisconErr | -2147 | FTP server disconnected |
qpx_urlDataHFTPURLErr | -2148 | Bad FTP URL |
NOTE When done working with an importer instance, you must destroy it by calling QPx_FreeImporter (unless you have assigned the importer to a QPix area, in which case its destruction will be handled by the area).
Example
// Create an importer for an image referenced by a URL C_LONGINT($error) C_TEXT($imageURL) C_LONGINT(gQPixImporter) $imageURL:="http://www.someplace.com/image.jpg" $error:=QPx_NewImporterForURL (gQPixImporter;$imageURL) If ($error=qpx_noErr) //Importer created successfully End if