Hello, Guest.

Image Manipulation

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);

Docs Navigation

JomSocial Video Testimonial Contest. Top 5 best videos wins iPod Nano 4G.

Slashes & Dots Sdn. Bhd.
MALAYSIA OFFICE
No 1-7, Signature Office,
The Boulevard Mid Valley City,
Lingkaran Syed Putra,
59200 Kuala Lumpur, Malaysia.
U.S. OFFICE
251 West Central Avenue #146,
Springboro, Ohio 45066, U.S.A.

Tel: +60 (3) 2282-1997
Fax: +60 (3) 2283-1997
E-mail:
Copyright © 2007 - 2009 JomSocial.com. All rights reserved.
JomSocial is made for Joomla!
JomSocial Community Count

642 users currently online | 84564 forum posts