Beispiel #1
0
 /**
  * Get the size names
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function generateFileNames()
 {
     $names = array();
     foreach ($this->maps as $size => $postfix) {
         $names[$size] = $this->image->getName(true) . $postfix . $this->image->getExtension();
     }
     return $names;
 }
Beispiel #2
0
 /**
  * Generates a file name for an image
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function generateFilename($size, $fileName = '')
 {
     if (empty($fileName)) {
         $fileName = $this->image->getName(false);
     }
     // Remove any previously _stock from the image name
     $fileName = str_ireplace('_stock', '', $fileName);
     $extension = $this->image->getExtension();
     $fileName = str_ireplace($extension, '', $fileName);
     // Ensure that the file name is lowercased
     $fileName = strtolower($fileName);
     // Ensure that the file name is valid
     $fileName = JFilterOutput::stringURLSafe($fileName);
     // Append the size and extension back to the file name.
     $fileName = $fileName . '_' . $size . $extension;
     return $fileName;
 }
Beispiel #3
0
 /**
  * Generates a random image name based on the node id.
  *
  * Example:
  * <code>
  * <?php
  * $avatar 	= FD::get( 'Avatar' );
  *
  * // Returns md5 hash.
  * $output	= $avatar->generateName( 'anyprefix' , 'anysuffix' , '.png' );
  *
  * @since	1.0
  * @access	public
  * @param	string	Prefix for the file name.
  * @param	string	Suffix for the file name.
  * @param	string	The extension of the file.
  */
 public function getUniqueName()
 {
     $name = md5($this->image->getName() . uniqid());
     return $name;
 }