Skip to content

Resources: Images

Danny Li edited this page Feb 4, 2018 · 1 revision

Special methods

  • ::update - Update the image description.
  • ::convert - Convert a backup image to a snapshot image.
  • ::delete - Delete an image.

Image object

The Image object has the following methods:

<?php
use Exploriment\HetznerCloud;

// retrieve the image
$image = HetznerCloud\Images::find(1);

// returns the image ID (int)
$image->getId();

// returns the image type (string)
$image->getType();

// type = snapshot? (boolean)
$image->isSnapshot();

// type = system? (boolean)
$image->isSystem();

// type = backup? (boolean)
$image->isBackup();

// returns the image status (string)
$image->getStatus();

// status = available? (boolean)
$image->isAvailable();

// status = creating? (boolean)
$image->isCreating();

// returns the image name (string)
$image->getName();

// returns the image description (string)
$image->getDescription();

// returns the image size (float or null)
$image->getImageSize();

// returns the disk size (float)
$image->getDiskSize();

// returns when the image was created (string)
$image->getCreated();

// returns information about the server the image was created from (object or null)
$image->getCreatedFrom();

// returns the server the image is bound to (int or null)
$image->getBoundTo();

/**
 * returns the Server object that the image is bound to
 * @see https://github.com/Exploriment/hcloud-php/wiki/resources:-servers#server-object
 */
$image->getBoundToServer();

// returns the OS flavor (string)
$image->getOsFlavor();

// returns the OS version (string or null)
$image->getOsVersion();

// is rapid deploy available for this image? (boolean)
$image->canRapidDeploy();

/**
 * @see https://github.com/Exploriment/hcloud-php/wiki/Images::update
 */
$image->update($description);

/**
 * @see https://github.com/Exploriment/hcloud-php/wiki/Images::convert
 */
$image->convert();

/**
 * @see https://github.com/Exploriment/hcloud-php/wiki/Images::delete
 */
$image->delete();
Clone this wiki locally