Location: PHPKode > projects > Moc10 PHP Library > docs/api-glossary/image_crop.html
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!-- Header //-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">


        Moc10 Library v1.9.7 | A Lightweight PHP Library

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="author" content="Nick Sagona"/>
    <meta name="keywords" content="php, php library, php framework, php code library, moc10 library, moc10media, moc 10 media, moc 10, object oriented programming, oop" />
    <meta name="description" content="Moc10 Library is a lightweight, easily deployable PHP library that integrates a handful of some of the 'basics' that go into many websites, projects and applications." />
    <meta name="robots" content="all" />

    <link rel="stylesheet" type="text/css" href="../styles.css" />
    <link rel="shortcut icon" href="../moc10media.ico" type="image/ico" />


<!-- Content //-->
<div id="content">

    <h1>Moc10 Library v1.9.7 | A Lightweight PHP Library</h1>
    <ul id="mainNav">
        <li><a href="../index.html">Overview</a></li>
        <li><a href="../features.html">Features</a></li>
        <li><a href="../manual.html">Manual</a></li>
        <li>API Glossary</li>
        <li><a href="../api-docs/index.html">API Docs</a></li>
        <li><a href="../faqs.html">FAQs</a></li>
        <li><a href="../development.html">Development</a></li>
        <li><a href="../download.html">Download</a></li>
    <span class="right"><a href="../api-glossary.html">&lt; back to glossary</a></span>
    <h3>API Glossary &gt; The Image Component</h3>
    <h4>$image-&gt;crop($px, $x = 0, $y = 0, $q = null, $to = null)</h4>

@param  int|string $px (Pixel size in which to crop the image)
@param  int|string $x  (X offset)
@param  int|string $y  (Y offset)
@param  int|string $q  (Image quality)
@param  string $to     (New file to save to)
        This method crops the image object to a square image whose dimensions are based on the value of the $px argument. The optional $x and $y arguments allow for the adjustment of the crop to select a certain area of the image to be cropped. For example, if the values of $px = 50, $x = 20, $y = 0 are passed, then a 50px X 50px image will be created from the original image, with its origins starting at the (20, 0) x-y coordinates. The $q argument is an optional argument for the quality of the image that must range between 0 (lowest) and 100 (highest.)
<!-- Footer //-->
<div id="footer">
    Copyright &copy; 2009-2011, Moc 10 Media, LLC. All rights reserved.

Return current item: Moc10 PHP Library