# The Red Project: Photo Class Reference

All Classes Namespaces Files Functions Variables Pages
Photo Class Reference

## Public Member Functions

| __construct ($data, $type=null)
| __destruct ()
| is_imagick ()
| get_FormatsMap ()
| is_valid ()
| getWidth ()
| getHeight ()
| getImage ()
| getType ()
| getExt ()
| scaleImage ($max)
| rotate ($degrees)
| flip ($horiz=true, $vert=false)
| orient ($filename)
| scaleImageUp ($min)
| scaleImageSquare ($dim)
| cropImage ($max, $x, $y, $w, $h)
| saveImage ($path)
| imageString ()
| store ($aid, $uid, $xchan, $rid, $filename, $album, $scale, $profile=0, $allow_cid= '', $allow_gid= '', $deny_cid= '', $deny_gid= '')

## Static Public Member Functions

static | supportedTypes ()

## Private Attributes

| $image
| $imagick
| $width
| $height
| $valid
| $type
| $types

## Constructor & Destructor Documentation

Photo::__construct | ( |  | $data,
|  |  | $type = `null`
| ) |  |

Setup the image to the format it will be saved to

setup the compression here, so we'll do it only once

From http://www.imagemagick.org/script/command-line-options.php#quality:

'For the MNG and PNG image formats, the quality value sets the zlib compression level (quality / 10) and filter-type (quality % 10). The default PNG "quality" is 75, which means compression level 7 with adaptive PNG filtering, unless the image has a color map, in which case it means compression level 7 with no PNG filtering'

Photo::__destruct | ( |  | ) |

## Member Function Documentation

Photo::cropImage | ( |  | $max,
|  |  | $x,
|  |  | $y,
|  |  | $w,
|  |  | $h
| ) |  |

We need to remove the canva, or the image is not resized to the crop: http://php.net/manual/en/imagick.cropimage.php#97232

Photo::flip | ( |  | $horiz = `true`,
|  |  | $vert = `false`
| ) |  |

Referenced by orient().

Photo::get_FormatsMap | ( |  | ) |

Maps Mime types to Imagick formats

Referenced by __construct().

Photo::getExt | ( |  | ) |

Photo::getHeight | ( |  | ) |

Referenced by store().

Photo::getImage | ( |  | ) |

Photo::getType | ( |  | ) |

Referenced by __construct(), getExt(), imageString(), orient(), and store().

Photo::getWidth | ( |  | ) |

Referenced by store().

Photo::imageString | ( |  | ) |

Referenced by saveImage(), and store().

Photo::is_imagick | ( |  | ) |

Referenced by __construct(), __destruct(), cropImage(), flip(), getHeight(), getImage(), getWidth(), imageString(), is_valid(), rotate(), scaleImage(), scaleImageSquare(), and scaleImageUp().

Photo::is_valid | ( |  | ) |

Referenced by cropImage(), flip(), getExt(), getHeight(), getImage(), getType(), getWidth(), imageString(), orient(), rotate(), saveImage(), scaleImage(), scaleImageSquare(), and scaleImageUp().

Photo::orient | ( |  | $filename | ) |

Photo::rotate | ( |  | $degrees | ) |

Referenced by orient().

Photo::saveImage | ( |  | $path | ) |

Photo::scaleImage | ( |  | $max | ) |

If it is not animated, there will be only one iteration here, so don't bother checking

Referenced by cropImage(), and scaleImageUp().

Photo::scaleImageSquare | ( |  | $dim | ) |

Photo::scaleImageUp | ( |  | $min | ) |

Photo::store | ( |  | $aid,
|  |  | $uid,
|  |  | $xchan,
|  |  | $rid,
|  |  | $filename,
|  |  | $album,
|  |  | $scale,
|  |  | $profile = `0`,
|  |  | $allow_cid = `''`,
|  |  | $allow_gid = `''`,
|  |  | $deny_cid = `''`,
|  |  | $deny_gid = `''`
| ) |  |

static Photo::supportedTypes | ( |  | ) |

static

supported mimetypes and corresponding file extensions

Imagick::queryFormats won't help us a lot there... At least, not yet, other parts of friendica uses this array

Referenced by __construct(), fbrowser_content(), guess_image_type(), photos_content(), and photos_post().

## Member Data Documentation

Photo::$height

private

Referenced by getHeight(), scaleImage(), and scaleImageUp().

Photo::$image

private

Referenced by getImage().

Photo::$imagick

private

Put back gd stuff, not everybody have Imagick

Referenced by is_imagick().

Photo::$type

private

Referenced by __construct(), and getType().

Photo::$types

private

Photo::$valid

private

Referenced by is_valid().

Photo::$width

private

Referenced by getWidth(), scaleImage(), and scaleImageUp().

The documentation for this class was generated from the following file:

- include/Photo.php