In the Inserting Image Uploader PHP into Page article we have familiarized with Image Uploader PHP library by giving the example of creating a simple web application. In the present topic we will consider more specific tasks of the PHP library usage which were not mentioned in the previous one.

Adding License Key

According to Aurigma licensing policy Image Uploader requires to be registered with license keys. There are two license key types: trial and full. A trial license key is intended to evaluate Image Uploader on any domain (not only on localhost). See the How to Evaluate Image Uploader article for the detailed information on evaluation version. Full license key removes limitations of the evaluation version and allows you to use the control on a domain name or IP address you have purchased Image Uploader for. Find the detailed information about full license keys and licensing options in the Removing Limitations of Evaluation Version topic.

To register Image Uploader with a license key just specify it as a value of the setLicenseKey($value) property, as it is shown below.

PHP

<?php
    $imageUploader = new ImageUploader("ImageUploader1", 650, 400);

    $imageUploader->setLicenseKey("XXXXX-XXXXX-XXXXX-XXXXX-XXXXX;YYYYY-YYYYY-YYYYY-YYYYY-YYYYY");
    
    $imageUploader->render();
?>
Note

If you have several keys, you should specify them separated with semicolons.

Enabling or Disabling ActiveX or Java Versions

Image Uploader consists of two editions, namely ActiveX control and Java applet. By default, both of them are enabled and used in accordance with a browser type (ActiveX control for Internet Explorer and Java applet for Mozilla Firefox, Safari, or other browsers having Java runtime support). However, if you purchased a license for one edition only, you should disable another one. To do this, set the setActiveXControlEnabled($value) or setJavaAppletEnabled($value) properties correspondingly to false.

PHP

<?php
    $imageUploader = new ImageUploader("ImageUploader1", 650, 400);

    $imageUploader->setActiveXControlEnabled(true);
    $imageUploader->setJavaAppletEnabled(false);

    $imageUploader->render();
?>

Configuring and Using Installation Progress

Image Uploader PHP library allows displaying special instructions which help users to download and install Image Uploader. This feature is called installation progress and is comprehensively described in the Using Image Uploader Installation Progress topic. Here we will briefly consider how to enable and customize this functionality using Image Uploader PHP library.

To customize downloading and installation instructions you should configure the InstallationProgress object which can be retrieved using the ImageUploader::getInstallationProgress() property. The InstallationProgress class is defined in the InstallationProgress.class.php file and implements a number of properties intended to configure downloading and installation instructions and information. For example, the setVisible($value) property specifies whether to display this information while the ActiveX control or Java applet is being downloaded and installed. The setCommonHtml($value) in its turn contains HTML-marked description of Image Uploader displayed on the page instead of the ActiveX control before it is completely installed and initialized. The other properties are described in the Using Image Uploader Installation Progress topic. The following code sample illustrates how to configure installation progress in the PHP library.

PHP

<head>
    <title>My Web Site</title>
</head>
<body>

<?php
    $imageUploader = new ImageUploader("ImageUploader1", 650, 400);

    $imageUploader->getInstallationProgress()->setVisible(true);
    $imageUploader->getInstallationProgress()->setCommonHtml("<p>Aurigma Image Uploader ActiveX control is 
        necessary to upload your files quickly and easily. You will be able to select multiple images in 
        user-friendly interface instead of clumsy input fields with <strong>Browse</strong> button.</p>");
    $imageUploader->getInstallationProgress()->setProgressHtml("<p><img src=\"{0}\" /><br />Loading Aurigma 
        Image Uploader ActiveX...</p>");
    $imageUploader->getInstallationProgress()->setJavaProgressHtml("<p><img src=\"{0}\" /><br />Loading 
        Aurigma Image Uploader Java Applet...</p>");    
    $imageUploader->getInstallationProgress()->setProgressImageUrl("mywaitIndicator.gif");
    $imageUploader->getInstallationProgress()->setCommonInstallJavaHtml("<p>You need to install Java for 
        running Image Uploader.</p>");
    $imageUploader->getInstallationProgress()->setIE7InstructionsHtml("<p>To install Image Uploader, please
        click on the <strong>Information Bar</strong> and select <strong>Install ActiveX Control</strong> 
        or <strong>Run ActiveX Control</strong> from the dropdown menu.</p><p>Then either click 
        <strong>Run</strong> or after page reload click    <strong>Install</strong> when you see the control 
        installation dialog. If you don't see Information Bar, please try to reload the page and/or check 
        your security settings.</p>");
    $imageUploader->getInstallationProgress()->setIE7InstallJavaHtml("<p>To install Java, please click 
        on the <strong>Information Bar</strong> and select <strong>Install ActiveX Control</strong> or 
        <strong>Run ActiveX Control</strong> from the dropdown menu.</p><p>Then either click 
        <strong>Run</strong> or after the page reload click <strong>Install</strong> when you see the 
        control installation dialog. If you don't see Information Bar, please try to reload the page 
        and/or check your security settings.</p>");

    $imageUploader->render();
?>

</body>

Preserving Sessions and Authentication Tickets Passed in Cookies

In the case when your web application uses cookies for keeping session or authentication information, Image Uploader PHP library automatically passes this information to the upload request. So you do not need to care about keeping your cookies saved when server upload script is called. However, if necessary, you can disable automatic cookie preservation by specifying the setPreserveHttpCookies($value) property to false.

Note

If you need to change the name of session cookie, you should specify the same name on the page handling upload via session_name() PHP function.