Manipulating images with JomSocial is pretty simple. You can just use one of the existing helper functions. Before you can begin using the helpers, you need to load the image helper library.

Adding watermarks to an existing image

cImageAddWaterMark accepts the following parameters :-

  • $imageFile : The path to the original image or background
  • $destinationFile : The path to the file that you want to save it to.
  • $imageType : Type of image whether a 'image/jpeg' , 'image/png' , 'image/gif'
  • $watermarkFile: The path to the watermark file
  • $positionX (optional): Allows you to specify the x position of the watermark in the image. Defaults to 0 if not specified.
  • $positionY (optional): Allows you to specify the y position of the watermark in the image. Defaults to 0 if not specified.

Example

// This is required to load the image helper
CFactory::load( 'helpers' , 'image' );
// Assume that we already know the following properties
$imageFile       = JPATH_ROOT . DS . 'images' . DS . 'joomla_logo_black.jpg';
$destinationFile = JPATH_ROOT . DS . 'images' . DS . 'joomla_logo_blak_watermark.jpg';
$imageType       = 'image/jpeg';
$watermarkFile   = JPATH_ROOT . DS . 'images' . DS . 'sort_asc.png';
$watermarkWidth  = 12;
$watermarkHeight = 12;
// Get the width and height of image first so we can calculate where to place the watermarks.
list($imageWidth,$imageHeight) = getimagesize($imageFile);
// Place water mark at the bottom right of the image
$positionX       = ($imageWidth - $watermarkWidth);
$positionY       = ($imageHeight - $watermarkHeight);
cImageAddWaterMark($imageFile,$destinationFile,$imageType,$watermarkFile,$positionX,$positionY);

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW