2012-03-17 13:08:28 +00:00
< ? php
/**
* function used to get photos
*/
function get_photos ( $param )
{
global $cbphoto ;
return $cbphoto -> get_photos ( $param );
}
2012-03-17 14:50:31 +00:00
//Simple Width Fetcher
function getWidth ( $file )
{
$sizes = getimagesize ( $file );
if ( $sizes )
return $sizes [ 0 ];
}
//Simple Height Fetcher
function getHeight ( $file )
{
$sizes = getimagesize ( $file );
if ( $sizes )
return $sizes [ 1 ];
}
//Load Photo Upload Form
function loadPhotoUploadForm ( $params )
{
global $cbphoto ;
return $cbphoto -> loadUploadForm ( $params );
}
//Photo File Fetcher
function get_photo ( $params )
{
global $cbphoto ;
return $cbphoto -> getFileSmarty ( $params );
}
//Photo Upload BUtton
function upload_photo_button ( $params )
{
global $cbphoto ;
return $cbphoto -> upload_photo_button ( $params );
}
2012-09-13 12:18:39 +00:00
//Photo Embed Cides - Dropped
//function photo_embed_codes($params)
//{
// global $cbphoto;
// return $cbphoto->photo_embed_codes($params);
//}
2012-03-17 14:50:31 +00:00
//Create download button
function photo_download_button ( $params )
{
global $cbphoto ;
return $cbphoto -> download_button ( $params );
}
2012-04-30 10:49:46 +00:00
function load_photo_controls ( $args ) {
global $cbphoto ;
if ( ! empty ( $args [ 'photo' ])) {
$controls = explode ( ',' , $args [ 'controls' ]);
$controls = array_map ( 'trim' , $controls );
foreach ( $controls as $control ) {
$control_args = null ;
// Parameters for this controls
$control_args = $args [ $control ];
$method_to_call = 'load_' . $control ;
if ( method_exists ( $cbphoto , $method_to_call ) ) {
$cbphoto -> $method_to_call ( $args [ 'photo' ], $control_args ); // Call the method
}
}
}
}
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
2012-10-03 19:00:29 +00:00
/**
* This function returns the untouched / original file
* of photo
*
* @ global OBJECT $cbphoto
* @ param ARRAY $photo
* @ param BOOL $with_path
* @ return STRING
*/
2012-07-18 22:38:02 +00:00
function get_original_photo ( $photo , $with_path = false ) {
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
global $cbphoto ;
if ( ! is_array ( $photo ) ) {
$ph = $cbphoto -> get_photo ( $photo );
} else {
$ph = $photo ;
}
if ( is_array ( $ph ) ) {
2012-07-18 22:38:02 +00:00
$files = $cbphoto -> get_image_file ( $ph , 'o' , true , null , $with_path , true );
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
$orig = $ph [ 'filename' ] . '.' . $ph [ 'ext' ];
$file = array_find ( $orig , $files );
return $file ;
}
}
2012-10-03 19:00:29 +00:00
/**
* This will extract the most common colors from photo .
* Record it ' s HEX code , rgb code and percent found in photo ,
* than before entering database , it runs through json_encode .
*
* @ global OBJECT $db
* @ global OBJECT $cbphoto
* @ param ARRAY $photo
* @ return type
*/
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
function insert_photo_colors ( $photo ) {
global $db , $cbphoto ;
if ( ! is_array ( $photo ) ) {
$ph = $cbphoto -> get_photo ( $photo );
} else {
$ph = $photo ;
}
if ( is_array ( $ph ) && isset ( $ph [ 'photo_id' ]) ) {
if ( $id = $db -> select ( tbl ( 'photosmeta' ), 'pmeta_id' , " photo_id = ' " . $ph [ 'photo_id' ] . " ' AND meta_name = 'colors' " ) ) {
return $id ;
}
2012-06-01 11:57:50 +00:00
$dir = PHOTOS_DIR . '/' . get_photo_date_folder ( $ph ) . '/' ;
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
$file = get_original_photo ( $ph );
$path = $dir . $file ;
if ( file_exists ( $path ) ) {
$img = new CB_Resizer ( $path );
$colors = $img -> color_palette ();
2012-05-28 07:10:27 +00:00
$img -> _destroy (); // Free memory
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
if ( $colors ) {
$jcolors = json_encode ( $colors );
$insert_id = $db -> insert ( tbl ( 'photosmeta' ), array ( 'photo_id' , 'meta_name' , 'meta_value' ), array ( $ph [ 'photo_id' ], 'colors' , '|no_mc|' . $jcolors ) );
if ( $insert_id ) {
return $insert_id ;
}
}
}
}
}
2012-10-03 19:00:29 +00:00
/**
* This function inserts EXIF data embedded by cameras .
*
* @ global OBJECT $db
* @ global OBJECT $cbphoto
* @ param ARRAY $photo
* @ return INT
*/
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
function insert_exif_data ( $photo ) {
global $db , $cbphoto ;
if ( ! is_array ( $photo ) ) {
$ph = $cbphoto -> get_photo ( $photo );
} else {
$ph = $photo ;
}
if ( is_array ( $ph ) && isset ( $ph [ 'photo_id' ]) ) {
2012-06-01 11:57:50 +00:00
$dir = PHOTOS_DIR . '/' . get_photo_date_folder ( $ph ) . '/' ;
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
if ( strtolower ( $ph [ 'ext' ]) != 'jpg' ) {
/* return if photo is not jpg */
return ;
}
$file = get_original_photo ( $ph );
$path = $dir . $file ;
if ( file_exists ( $path ) ) {
/* File exists. read the exif data. Thanks to CopperMine, Love you */
2012-05-28 07:10:27 +00:00
$data = read_exif_data_raw ( $path , 0 );
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
if ( isset ( $data [ 'SubIFD' ]) ) {
$exif_to_include = array ( 'IFD0' , 'SubIFD' , 'IFD1' , 'InteroperabilityIFD' );
foreach ( $exif_to_include as $eti ) {
if ( isset ( $data [ $eti ]) ) {
$exif [ $eti ] = $data [ $eti ];
}
}
2012-06-01 11:57:50 +00:00
/* Removing unknown tags from exif data */
foreach ( $exif as $parent => $tags ) {
foreach ( $tags as $tag => $value ) {
if ( $tag == 'MakerNote' ) {
if ( is_array ( $value ) ) {
foreach ( $value as $mtag => $mvalue ) {
if ( strpos ( $mtag , 'unknown' ) !== false ) {
unset ( $exif [ $parent ][ $tag ][ $mtag ] );
} else {
$exif [ $parent ][ $tag ][ $mtag ] = trim ( $mvalue );
}
}
}
}
if ( is_array ( $value )) {
continue ;
}
if ( strpos ( $tag , 'unknown' ) !== false ) {
unset ( $exif [ $parent ][ $tag ] );
} else {
$exif [ $parent ][ $tag ] = trim ( $value );
}
}
}
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
$jexif = json_encode ( $exif );
2012-06-01 11:57:50 +00:00
$jexif = preg_replace ( '/\\\(u000)(.){1}/' , '' , $jexif );
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
/* add new meta of exif_data for current photo */
2012-06-01 11:57:50 +00:00
$insert_id = $db -> insert ( tbl ( 'photosmeta' ), array ( 'photo_id' , 'meta_name' , 'meta_value' ), array ( $ph [ 'photo_id' ], 'exif_data' , " |no_mc| $jexif " ) );
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
if ( $insert_id ) {
/* update photo has_exif to yes, so we know that this photo has exif data */
Updated : upgrade_3.0.sql
Updated : edit_account.php, Now when avatar is set it redirects to user profile
Updated : EXIF Data url
Updated : queryString function regex. Old one was removing complete query string
Updated : display_manager_links(), now all variables except omo are removed from url
Added : Make profile link for photos @startup.php
Added : return_object_order in template_functions.php, This returns the order of provided omo value
Updated : Order checking @manage_collections.php and @manage_photos.php. Now only return_object_order is used
Updated : Updating of photo when it is uploaded
Updated : photo.html, single_feed.html, single_feed_comment.html, photo_form.html, user.html, video.html, /view_channel/feed.html, manage_photos.html, view_channel.html
Added : user_contacts.html, user_photos.html and user_videos.html
Added : autoComplete parameter for photo tagging
Updated : default.css, feeds.css and view_channel.css
Updated : user_contacts.php
Added : Next and Previous photos links @view_item.php
Fixed : Avatar Delete
Fixed : getProfileItem method of $userquery
2012-12-04 13:27:13 +00:00
$db -> update ( tbl ( $cbphoto -> p_tbl ), array ( 'has_exif' ), array ( 'yes' ), " photo_id = ' " . $ph [ 'photo_id' ] . " ' " );
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
return $insert_id ;
}
}
}
}
}
2012-10-03 19:00:29 +00:00
/**
* This function takes EXIF data stored in database and make
* required indexes that are most important or user usually
* looks for these details .
*
* @ param ARRAY $exif
* @ param INT $photo
* @ return ARRAY
*/
2012-06-01 11:57:50 +00:00
function ready_exif_data ( $exif , $photo = null ) {
if ( empty ( $exif ) || ! is_array ( $exif ) ) {
return false ;
}
$formatted [ 'dates' ][ 'taken' ] = $exif [ 'IFD0' ][ 'DateTime' ] ? $exif [ 'IFD0' ][ 'DateTime' ] : null ;
$formatted [ 'dates' ][ 'uploaded' ] = ( $photo ? $photo [ 'date_added' ] : null );
$formatted [ 'base' ][ 'camera' ] = ( $exif [ 'IFD0' ][ 'Model' ] ? $exif [ 'IFD0' ][ 'Model' ] : null );
$formatted [ 'base' ][ 'exposure' ] = ( $exif [ 'SubIFD' ][ 'ExposureTime' ] ? $exif [ 'SubIFD' ][ 'ExposureTime' ] : null );
$formatted [ 'base' ][ 'aperture' ] = ( $exif [ 'SubIFD' ][ 'ApertureValue' ] ? $exif [ 'SubIFD' ][ 'ApertureValue' ] : null );
$formatted [ 'base' ][ 'focal length' ] = ( $exif [ 'SubIFD' ][ 'FocalLength' ] ? $exif [ 'SubIFD' ][ 'FocalLength' ] : null );
$all = array ();
$merge = array ( 'IFD0' , 'SubIFD' );
foreach ( $merge as $tag ) {
if ( isset ( $exif [ $tag ]) ) {
$all = array_merge ( $all , $exif [ $tag ]);
}
}
if ( isset ( $exif [ 'SubIFD' ][ 'MakerNote' ]) ) {
$all = array_merge ( $all , $exif [ 'SubIFD' ][ 'MakerNote' ] );
unset ( $all [ 'MakerNote' ] );
}
/* Remove Base indexes and DateTime */
unset ( $all [ 'DateTime' ] );
unset ( $all [ 'Model' ] );
unset ( $all [ 'ExposureTime' ] );
unset ( $all [ 'ApertureValue' ] );
unset ( $all [ 'FocalLength' ] );
$formatted [ 'rest' ] = $all ;
return $formatted ;
}
2012-10-03 19:00:29 +00:00
/**
* This converts camelCase of EXIF index into
* readable string .
*
* @ param STRING $str
* @ return STRING
*/
2012-06-01 11:57:50 +00:00
function format_exif_camelCase ( $str ) {
if ( ! $str ) {
return false ;
}
$re = '/(?<=[a-z])(?=[A-Z])/' ;
$str = preg_split ( $re , $str );
return implode ( ' ' , $str );
}
2012-10-03 19:00:29 +00:00
/**
* This outputs an img HTML tag . $src is requred .
* $attrs is array contains [ 'attribute name' => attribute value ]
* @ param STRING $src
* @ param ARRAY $attrs
* @ return STRING
*/
2012-05-28 07:10:27 +00:00
function cb_output_img_tag ( $src , $attrs = null ) {
if ( empty ( $src ) ) {
return false ;
}
$start = " <img " ;
$close = " /> " ;
$attributes = ' src = "' . $src . '"' ;
if ( is_array ( $attrs ) ) {
/* We'll just loop through and add attrs in image */
foreach ( $attrs as $attr => $value ) {
if ( strtolower ( $attr ) != 'extra' ) {
$attributes .= ' ' . $attr . ' = "' . $value . '" ' ;
} else {
$attributes .= $value ;
}
}
}
// THIS IS MERGINGGGGGG
return $start . $attributes . $close ;
}
2012-05-18 13:47:20 +00:00
/**
* Add a new thumb dimension in thumb_dimensions array .
*
* @ global OBJECT $cbphoto
* @ param STRING $code
* @ param INT $width
* @ param INT $height
* @ param INT $crop
* @ param BOOL $watermark
* @ param BOOL $sharpit
* @ return array
*/
2012-09-13 12:18:39 +00:00
function add_custom_photo_size ( $name , $code , $width = 0 , $height = 0 , $crop = 4 , $watermark = false , $sharpit = false ) {
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
global $cbphoto ;
$sizes = $cbphoto -> thumb_dimensions ;
$code = strtolower ( $code );
2012-05-28 07:10:27 +00:00
if ( $code == 't' || $code == 'm' || $code == 'l' || $code == 'o' || preg_match ( '/[^\w]/' , $code , $matches ) ) {
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
return false ;
}
if ( ! is_numeric ( $width ) || ! is_numeric ( $height ) ) {
return false ;
}
$sizes [ $code ] = array (
2012-09-13 12:18:39 +00:00
'name' => $name ,
Added : Photo EXIF Data in insert_photo()
Added : Make Avatar from any photo
Added : Collection cover photo
Added : An array for thumb creations. Includes, code, width, height, watermark, sharpit
Added : Resizer class in common.php
Added : jquery.Jcrop.js in edit_account
Added : A common function called cb_filename. All filenames used in clipbucket follow a specific syntax
Added : Four new function for photos. get_original_photo, insert_photo_colors, insert_exif_data & add_custom_photo_size
Added : User Avatar collection functions. But they are not in use right now. This need proper thinking
Added : New files: mobile-form-class.php, resizer.class.php, exif.php, makers files for exif, jquery.Jcrop plugin, some template files
2012-05-16 07:27:54 +00:00
'width' => abs ( $width ),
'height' => abs ( $height ),
'crop' => $crop ,
'watermark' => $watermark ,
'sharpit' => $sharpit
);
return $cbphoto -> thumb_dimensions = $sizes ;
}
2012-05-18 13:47:20 +00:00
2012-05-28 07:10:27 +00:00
function get_all_custom_size_photos ( $id ) {
global $cbphoto ;
if ( ! is_array ( $id ) ) {
$photo = $cbphoto -> get_photo ( $id );
} else {
$photo = $id ;
}
/* I 'm unable to select only custom size photos using glob, so we' ll
* get all photos loop through exclude clipbucket sizes and save only
* custom ones
*/
$files = $cbphoto -> get_image_file ( $photo , null , true , null , false );
$cbsize = $cbphoto -> thumb_dimensions ;
if ( $files ) {
foreach ( $files as $file ) {
$code = $cbphoto -> get_image_type ( $file );
if ( ! isset ( $cbsize [ $code ]) ) {
$custom_files [] = $file ;
}
}
if ( is_array ( $custom_files ) ) {
return $custom_files ;
} else {
return false ;
}
}
}
2012-10-03 19:00:29 +00:00
/**
* This gets default photo dimensions . If $filter is true
* We ' ll run photo_dimensions filter to all available dimensions .
*
* @ global OBJECT $cbphoto
* @ param BOOL $filter
* @ return ARRAY
*/
2012-07-18 22:38:02 +00:00
function get_photo_dimensions ( $filter = false ) {
2012-05-28 07:10:27 +00:00
global $cbphoto ;
2012-07-18 22:38:02 +00:00
if ( $filter === true ) {
apply_filters ( null , 'photo_dimensions' );
}
2012-05-28 07:10:27 +00:00
return $cbphoto -> thumb_dimensions ;
}
function clean_custom_photo_size ( $id ) {
global $cbphoto ;
$photos = get_all_custom_size_photos ( $id );
// Apply photo_dimension filters so get all custom sizes
apply_filters ( null , 'photo_dimensions' );
$dimensions = get_photo_dimensions ();
if ( $photos ) {
foreach ( $photos as $photo ) {
$code = $cbphoto -> get_image_type ( $photo );
/*
* The following custom code does not exist in thumb_dimensions array
*/
if ( ! isset ( $dimensions [ $code ] ) ) {
// I'm still thinking what to do with these extra photos
$path = PHOTOS_DIR . '/' . $photo ;
$month = 2678400 ; // month period
$lastacc = fileatime ( $path );
if ( ( $lastacc ) && time () - $lastacc > $month ) {
// it's been over a month since this file was accessed, remove it
unlink ( $photo );
}
}
}
}
}
2012-05-18 13:47:20 +00:00
function get_photometa ( $id , $name ) {
global $db ;
if ( empty ( $id ) || empty ( $name ) ) {
return false ;
}
$result = $db -> select ( tbl ( 'photosmeta' ), '*' , " photo_id = ' " . $id . " ' AND meta_name = ' " . strtolower ( $name ) . " ' " );
if ( $result ) {
return $result [ 0 ];
} else {
return false ;
}
}
function get_photo_meta_value ( $id , $name ) {
$meta = get_photometa ( $id , $name );
if ( $meta ) {
return $meta [ 'meta_value' ];
} else {
return false ;
}
}
/**
* It returns an array for photo action link .
* This should be used with photo_action_links
* filter .
*
* @ param string $text
* @ param string $href
* @ param string $target
* @ return mix
*/
function add_photo_action_link ( $text , $href , $icon = null , $target = null , $tags = null ) {
if ( ! $text && ! $href ) {
return false ;
}
if ( strlen ( trim ( $href ) ) == 1 && $href == '#' ) {
$skip_href_check = true ;
}
if ( ! preg_match ( '/(http:\/\/|https:\/\/)/' , $href , $matches ) && ! $skip_href_check ) {
return false ;
}
return array ( 'href' => $href , 'text' => $text , 'icon' => $icon , 'target' => $target , 'tags' => ( ! is_null ( $tags ) && is_array ( $tags ) ) ? $tags : null );
}
function cbphoto_pm_action_link_filter ( $links ) {
if ( userid () ) {
$links [] = add_photo_action_link ( lang ( 'Send in private message' ), '#' , 'envelope' , null , array ( 'id' => 'private_message_photo' , 'data-toggle' => 'modal' , 'data-target' => '#private_message_photo_form' ) );
}
2012-06-01 11:57:50 +00:00
global $photo , $cbphoto ;
Updated : upgrade_3.0.sql
Updated : edit_account.php, Now when avatar is set it redirects to user profile
Updated : EXIF Data url
Updated : queryString function regex. Old one was removing complete query string
Updated : display_manager_links(), now all variables except omo are removed from url
Added : Make profile link for photos @startup.php
Added : return_object_order in template_functions.php, This returns the order of provided omo value
Updated : Order checking @manage_collections.php and @manage_photos.php. Now only return_object_order is used
Updated : Updating of photo when it is uploaded
Updated : photo.html, single_feed.html, single_feed_comment.html, photo_form.html, user.html, video.html, /view_channel/feed.html, manage_photos.html, view_channel.html
Added : user_contacts.html, user_photos.html and user_videos.html
Added : autoComplete parameter for photo tagging
Updated : default.css, feeds.css and view_channel.css
Updated : user_contacts.php
Added : Next and Previous photos links @view_item.php
Fixed : Avatar Delete
Fixed : getProfileItem method of $userquery
2012-12-04 13:27:13 +00:00
if ( ( $photo [ 'has_exif' ] == 'yes' && $photo [ 'view_exif' ] == 'yes' ) || ( $photo [ 'userid' ] == userid () && $photo [ 'has_exif' ] == 'yes' ) ) {
2012-06-01 11:57:50 +00:00
$links [] = add_photo_action_link ( lang ( 'EXIF Data' ), $cbphoto -> photo_links ( $photo , 'exif_data' ), 'camera' );
}
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
2012-06-01 11:57:50 +00:00
/* Later we uncomment this, BAM something new to give >:D */
2012-07-25 11:53:42 +00:00
//$links[] = add_photo_action_link( lang('View Colors'),'#','tasks', null, array('onclick' => 'show_colors(event)', 'data-photo-id' => $photo['photo_id']) );
2012-06-01 11:57:50 +00:00
2012-05-18 13:47:20 +00:00
return $links ;
}
function register_photo_private_message_field ( $photo ) {
global $cbpm ;
$field = array (
'attach_photo' => array (
'name' => 'attach_photo' ,
'id' => 'attach_photo' ,
'value' => $photo [ 'photo_key' ],
'type' => 'hidden'
)
);
$cbpm -> add_custom_field ( $field );
}
function attach_photo_pm_handlers () {
global $cbpm ;
$cbpm -> pm_attachments [] = 'attach_photo' ;
$cbpm -> pm_attachments_parse [] = 'parse_photo_attachment' ;
}
function attach_photo ( $array ) {
global $cbphoto ;
if ( $cbphoto -> photo_exists ( $array [ 'attach_photo' ] ) ) {
return '{p:' . $array [ 'attach_photo' ] . '}' ;
}
}
function parse_photo_attachment ( $att ) {
global $cbphoto ;
preg_match ( '/{p:(.*)}/' , $att , $matches );
$key = $matches [ 1 ];
if ( ! empty ( $key ) ) {
$photo = $cbphoto -> get_photo ( $key , true );
if ( $photo ) {
assign ( 'photo' , $photo );
assign ( 'type' , 'photo' );
Template ( STYLES_DIR . '/global/blocks/pm/attachments.html' , false );
}
}
}
/**
* This is registered at cb_head ANCHOR . This loads photo actions links .
2012-11-27 11:56:45 +00:00
* You can use photo_action_links filter to new links .
2012-05-18 13:47:20 +00:00
*
* @ global object $cbphoto
* @ global array $photo
* @ return none
*/
function load_photo_actions () {
2012-05-28 07:10:27 +00:00
global $cbphoto , $photo , $userquery ;
2012-05-18 13:47:20 +00:00
if ( empty ( $photo ) || ! $photo || ! isset ( $photo [ 'ci_id' ] ) ) {
return false ;
}
$links = array ();
$download = photo_download_button ( array ( 'details' => $photo , 'return_url' => true ) );
if ( $download ) {
$links [] = array (
'href' => $download ,
'text' => lang ( 'download_photo' ),
'icon' => 'circle-arrow-down'
);
}
2012-11-27 11:56:45 +00:00
if ( userid () ) {
$user = $userquery -> udetails ;
if ( $photo [ 'collection_id' ] != $user [ 'avatar_collection' ] ) {
$links [] = array (
'href' => $cbphoto -> photo_links ( $photo , 'ma' ),
'text' => lang ( 'Make avatar' ),
'icon' => 'user'
);
} else {
$links [] = array (
'href' => $cbphoto -> photo_links ( $photo , 'ma' ),
'text' => lang ( 'Set as avatar' ),
'icon' => 'user'
);
}
}
// Apply Filter to links
$links = apply_filters ( $links , 'photo_action_links' );
2012-05-18 13:47:20 +00:00
if ( userid () && $photo [ 'userid' ] == userid () ) {
$links [] = array (
'href' => BASEURL . '/edit_photo.php?photo=' . $photo [ 'photo_id' ],
2012-11-27 11:56:45 +00:00
'text' => lang ( 'Edit Photo' ),
2012-05-18 13:47:20 +00:00
'target' => '_blank' ,
'icon' => 'pencil'
);
2012-05-28 07:10:27 +00:00
$links [] = array (
'href' => '#' ,
'text' => lang ( 'Delete Photo' ),
'icon' => 'remove' ,
'tags' => array (
2012-11-27 11:56:45 +00:00
'onclick' => 'displayConfirm("delete_photo_' . $photo [ 'photo_id' ] . '","' . lang ( 'Are you sure you want to delete this photo ? This action will delete photo permanently.' ) . '", delete_photo_ajax,"' . lang ( 'Delete This Photo' ) . '"); return false;' ,
2012-05-28 07:10:27 +00:00
'data-toggle' => 'modal' ,
'data-target' => '#delete_photo_' . $photo [ 'photo_id' ]
)
);
2012-05-18 13:47:20 +00:00
}
2012-11-27 11:56:45 +00:00
return $links ;
}
2012-05-28 07:10:27 +00:00
2012-11-27 11:56:45 +00:00
function display_photo_actions ( $icon = true , $white = false ) {
$links = load_photo_actions ();
if ( $links ) {
$output = '' ;
foreach ( $links as $link ) {
if ( $link [ 'href' ] ) {
$output .= '<li>' ;
$output .= " <a href=' " . $link [ 'href' ] . " ' " ;
if ( $link [ 'target' ] ) {
$output .= " target=' " . $link [ 'target' ] . " ' " ;
}
if ( $link [ 'style' ] ) {
$output .= " style=' " . $link [ 'style' ] . " ' " ;
}
// Add attributes
if ( $link [ 'tags' ] && is_array ( $link [ 'tags' ]) ) {
foreach ( $link [ 'tags' ] as $attribute => $value ) {
$output .= $attribute . " =' " . $value . " ' " ;
}
}
$output .= " > " ;
// Add icon
if ( $link [ 'icon' ] && $icon !== false ) {
if ( $white === true ) {
$white_icon = ' icon-white' ;
}
$output .= " <i class='icon- " . $link [ 'icon' ] . " $white_icon '></i> " ;
}
$output .= $link [ 'text' ];
$output .= " </a> " ;
$output .= '</li>' ;
}
}
}
2012-05-18 13:47:20 +00:00
2012-11-27 11:56:45 +00:00
return $output ;
2012-05-18 13:47:20 +00:00
}
/**
* This is registered at cb_head ANCHOR . This loads the photo tagging
* plugin in clipbucket . You can use tagger_configurations filter to change
* tagger configurations . Following is the list of configurations :
*
* |= Show Tag labels =| BOOL
* showLabels => true
*
* |= Provide an element ID and labels will loaded in them =| STRING
* labelWrapper => null
*
* |= Open labels links in new window =| BOOL
* labelLinksNew => false
*
* |= Make string like facebook : Tag1 , Tag2 and Tag3 =| BOOL
* makeString => true
*
* |= We JS to create string . Set true , to create using CSS . Be warn CSS might not work in > IE9 =| BOOL
* makeStringCSS => false
*
* |= This wraps Remove Tag link in round brackets ( ) =| BOOL
* wrapDeleteLinks => true
*
* |= Show a little indicator arrow . Note : Arrow is created purely from CSS . Might not work in > IE9 =| BOOL
* use_arrows => true
*
* |= To display Tag Photo elsewhere , provide an element ID =| STRING
* buttonWrapper => null
*
* |= This will add a tag icon previous to Tag Photo text =| BOOL
* addIcon => true
*
* @ global object $db
* @ global object $cbphoto
* @ global array $photo
* @ global object $userquery
* @ return none
*/
function load_tagging () {
global $db , $cbphoto , $photo , $userquery ;
if ( USE_PHOTO_TAGGING != true ) {
return false ;
}
if ( empty ( $photo ) || ! $photo || ! isset ( $photo [ 'ci_id' ] ) ) {
return false ;
}
$options = $cbphoto -> get_default_tagger_configs ();
$options [ 'allowTagging' ] = $photo [ 'allow_tagging' ];
$phrases = $options [ 'phrases' ];
/* User does not need phrases in apply_filters() function */
unset ( $options [ 'phrases' ] );
$options = apply_filters ( $options , 'tagger_configurations' );
/* Put back phrases in $options, over-wrtting JS Plugin Phrases */
$options [ 'phrases' ] = $phrases ;
$tags = $cbphoto -> get_photo_tags ( $photo [ 'photo_id' ] );
$autoComplete = $options [ 'autoComplete' ];
$uid = userid ();
2012-07-25 11:53:42 +00:00
if ( $uid ) {
2012-05-18 13:47:20 +00:00
$friends = $userquery -> get_contacts ( $uid , 0 , 'yes' );
}
if ( $friends ) {
foreach ( $friends as $contact ) {
$fa [ $contact [ 'contact_userid' ]] = $contact [ 'username' ];
$typeahead [] = $contact [ 'username' ];
}
}
if ( $tags ) {
/* Tags exists */
foreach ( $tags as $tag ) {
$needs_update = false ;
/* Check if tag is active or not and if current user is not tagger or owner of photo or is guest, do not show tag */
if ( ( ! $uid && $tag [ 'ptag_active' ] == 'no' ) || ( $tag [ 'ptag_active' ] == 'no' && $uid && $tag [ 'ptag_by_userid' ] != $uid && $tag [ 'photo_owner_userid' ] != $uid ) ) {
continue ;
}
$ta = array ();
$ta [ 'id' ] = $tag [ 'ptag_id' ];
$ta [ 'key' ] = $tag [ 'ptag_key' ];
$ta [ 'width' ] = $tag [ 'ptag_width' ];
$ta [ 'height' ] = $tag [ 'ptag_height' ];
$ta [ 'left' ] = $tag [ 'ptag_left' ];
$ta [ 'top' ] = $tag [ 'ptag_top' ];
$ta [ 'label' ] = $tag [ 'username' ] = $tag [ 'ptag_username' ];
$ta [ 'added_by' ] = $tag [ 'ptag_by_username' ];
$ta [ 'date_added' ] = nicetime ( $tag [ 'date_added' ], true );
if ( $tag [ 'ptag_active' ] == 'no' ) {
$ta [ 'pending' ] = true ;
}
/* Photo owner and User which has tagged */
if ( $uid == $tag [ 'photo_owner_userid' ] || $uid == $tag [ 'ptag_by_userid' ] ) {
$ta [ 'canDelete' ] = true ;
}
/*
If make sure tag is a user
See which person is online , tagger or tagged
If Tagger is online , give him option to delete
if Tagged is online , check if it 's tagger' s friend
if true , give option to delete
*/
if ( $tag [ 'ptag_isuser' ] == 1 ) {
if ( $uid == $tag [ 'ptag_by_userid' ] ){ // Tagger is online
$ta [ 'canDelete' ] = true ; // Grant him access to delete
if ( is_array ( $friends ) && $fa [ $tag [ 'ptag_userid' ] ] ) {
$ta [ 'link' ] = $userquery -> profile_link ( $tag [ 'ptag_userid' ] );
// Person tagged is in his contacts lists and already been tagged, remove it from typahead array
unset ( $typeahead [ end ( array_keys ( $typeahead , $tag [ 'ptag_username' ])) ] );
}
} else if ( $uid == $tag [ 'ptag_userid' ] ) {
if ( is_array ( $friends ) && $fa [ $tag [ 'ptag_by_userid' ] ] ) {
$ta [ 'canDelete' ] = true ;
$ta [ 'link' ] = $userquery -> profile_link ( $tag [ 'ptag_userid' ] );
}
}
2012-07-25 21:17:44 +00:00
/* This basically checks , if tagger and tagged and logged - in user are same
* create the profile link for logged - in user . This will be achieved if user tags
* itself on a photo
*/
if ( $tag [ 'ptag_by_userid' ] == $tag [ 'ptag_userid' ] && $tag [ 'ptag_userid' ] == $uid ) {
2012-07-25 11:53:42 +00:00
$ta [ 'link' ] = $userquery -> profile_link ( $tag [ 'ptag_userid' ] );
}
2012-05-18 13:47:20 +00:00
}
$defaultTags [] = $ta ;
}
$options [ 'defaultTags' ] = $defaultTags ;
}
if ( $friends && $typeahead && $options [ 'autoComplete' ] == 1 ) {
$options [ 'autoCompleteOptions' ][ 'source' ] = $typeahead ;
}
assign ( 'tagger_configs' , json_encode ( $options ));
assign ( 'selector_id' , $cbphoto -> get_selector_id ());
assign ( 'photo' , $photo );
Template ( STYLES_DIR . '/global/photo_tagger.html' , false );
}
2012-05-28 07:10:27 +00:00
/**
* This creates as array containing two index .
* index 0 => contains the mySQL JOIN statement
* index 1 => Alias for same columns in both tables
* Easy using for this function will be :
* ============================================
* list ( $join , $alias ) = join_collection_table ();
* $db -> select ( tbl ( 'photos' ) . $join , '*' . $alias , ....... );
* ============================================
* @ global object $cbcollection
* @ global object $cbphoto
* @ return array
*/
2012-05-18 13:47:20 +00:00
function join_collection_table () {
global $cbcollection , $cbphoto ;
$c = tbl ( $cbcollection -> section_tbl ) ; $p = tbl ( 'photos' );
$join = ' LEFT JOIN ' . ( $c ) . ' ON ' . ( $p . '.collection_id' ) . ' = ' . ( $c . '.collection_id' );
Updated : upgrade_3.0.sql
Updated : edit_account.php, Now when avatar is set it redirects to user profile
Updated : EXIF Data url
Updated : queryString function regex. Old one was removing complete query string
Updated : display_manager_links(), now all variables except omo are removed from url
Added : Make profile link for photos @startup.php
Added : return_object_order in template_functions.php, This returns the order of provided omo value
Updated : Order checking @manage_collections.php and @manage_photos.php. Now only return_object_order is used
Updated : Updating of photo when it is uploaded
Updated : photo.html, single_feed.html, single_feed_comment.html, photo_form.html, user.html, video.html, /view_channel/feed.html, manage_photos.html, view_channel.html
Added : user_contacts.html, user_photos.html and user_videos.html
Added : autoComplete parameter for photo tagging
Updated : default.css, feeds.css and view_channel.css
Updated : user_contacts.php
Added : Next and Previous photos links @view_item.php
Fixed : Avatar Delete
Fixed : getProfileItem method of $userquery
2012-12-04 13:27:13 +00:00
//$alias = ", $p.userid as userid, $p.views as views, $p.allow_comments as allow_comments, $p.allow_rating as allow_rating, $p.total_comments as total_comments, $p.date_added as date_added, $p.rating as rating, $p.rated_by as rated_by, $p.voters as voters, $p.featured as featured, $p.broadcast as broadcast, $p.active as active";
//$alias .= ", $c.collection_name as collection_name, $c.userid as cuserid, $c.views as cviews, $c.allow_comments as callow_comments, $c.allow_rating as callow_rating, $c.total_comments as ctotal_comments, $c.date_added as cdate_added, $c.rating as crating, $c.rated_by as crated_by, $c.voters as cvoters, $c.featured as cfeatured, $c.broadcast as cbroadcast, $c.active as cactive, $c.cover_photo";
2012-12-18 12:11:12 +00:00
$alias = " , $c .collection_name, $c .cover_photo, $c .category, $c .broadcast " ;
2012-05-18 13:47:20 +00:00
return array ( $join , $alias );
}
Updated : upgrade_3.0.sql
Updated : edit_account.php, Now when avatar is set it redirects to user profile
Updated : EXIF Data url
Updated : queryString function regex. Old one was removing complete query string
Updated : display_manager_links(), now all variables except omo are removed from url
Added : Make profile link for photos @startup.php
Added : return_object_order in template_functions.php, This returns the order of provided omo value
Updated : Order checking @manage_collections.php and @manage_photos.php. Now only return_object_order is used
Updated : Updating of photo when it is uploaded
Updated : photo.html, single_feed.html, single_feed_comment.html, photo_form.html, user.html, video.html, /view_channel/feed.html, manage_photos.html, view_channel.html
Added : user_contacts.html, user_photos.html and user_videos.html
Added : autoComplete parameter for photo tagging
Updated : default.css, feeds.css and view_channel.css
Updated : user_contacts.php
Added : Next and Previous photos links @view_item.php
Fixed : Avatar Delete
Fixed : getProfileItem method of $userquery
2012-12-04 13:27:13 +00:00
/**
* This function creates LEFT for meta data
*/
function join_meta_details () {
}
2012-05-28 07:10:27 +00:00
/**
* This function return all photos that are avatars
*
* @ global object $db
* @ global OBJECT $cbphoto
* @ param boolean $join
* @ param string $cond
* @ param string $order
* @ param int $limit
* @ return array
*/
function get_avatar_photos ( $join = true , $cond = null , $order = null , $limit = null ) {
global $db , $cbphoto ;
if ( ! is_null ( $cond ) ) {
$cond .= ' AND ' . $cond ;
}
if ( $join ) {
list ( $join , $alias ) = join_collection_table ();
}
$results = $db -> select ( tbl ( 'photos' ) . $join , '*' . $alias , " is_avatar='yes' $cond " , $limit , $order );
if ( $results ) {
return $results ;
} else {
return false ;
}
}
function is_photo_viewable ( $pid ) {
global $db , $cbphoto ;
if ( ! is_array ( $pid ) ) {
$photo = $cbphoto -> get_photo ( $pid );
} else {
$photo = $pid ;
}
if ( ! $photo ) {
e ( lang ( 'photo_not_exists' ));
if ( ! has_access ( 'admin_access' , true ) ) {
return false ;
} else {
return true ;
}
} else if ( $photo [ 'active' ] == 'no' ) {
e ( lang ( 'Photo is not active. Please Admin for details' ));
if ( ! has_access ( 'admin_access' , true ) ) {
return false ;
} else {
return true ;
}
} else if ( $photo [ 'is_mature' ] == 'yes' && ! userid () ) {
assign ( 'title' , $photo [ 'photo_title' ]);
template_files ( STYLES_DIR . '/global/blocks/mature_content.html' , false , false );
} else {
$funcs = cb_get_functions ( 'view_photo' );
if ( is_array ( $funcs ) ) {
foreach ( $funcs as $func ) {
if ( function_exists ( $func [ 'func' ] ) ) {
$data = $func [ 'func' ]( $photo );
if ( $data ) {
return $data ;
}
}
}
}
return true ;
}
}
2012-05-29 11:53:39 +00:00
function delete_photo_tags ( $photo ) {
global $db ;
// Delete all tags of current photo
$db -> delete ( tbl ( 'photo_tags' ), array ( 'photo_id' ), array ( $photo [ 'photo_id' ] ) );
}
function delete_photo_meta ( $photo ) {
global $db ;
// Delete all meta of current photo
$db -> delete ( tbl ( 'photosmeta' ), array ( 'photo_id' ), array ( $photo [ 'photo_id' ] ) );
}
2012-07-18 22:38:02 +00:00
/**
2012-10-03 19:00:29 +00:00
* Function gets the date folder for the current photo . If file_directory index is found
* in photo details , we 'll extract time from it' s filename and format it to check if files
* exists in desired folder . If not found false will return , confirming that photo exists
* at files / photos dir .
*
2012-07-18 22:38:02 +00:00
* @ param INT | ARRAY $pid , This could either be a photo id or photo array
* @ return STRING
*/
2012-05-29 11:53:39 +00:00
function get_photo_date_folder ( $pid ) {
global $cbphoto , $db ;
if ( ! is_array ( $pid ) ) {
$photo = $cbphoto -> get_photo ( $pid );
} else {
$photo = $pid ;
}
if ( empty ( $photo ) ) {
return false ;
}
// First check if we have db date_dir column
2012-09-11 07:05:29 +00:00
if ( $photo [ 'file_directory' ] ) {
$date_dir = $photo [ 'file_directory' ];
2012-05-29 11:53:39 +00:00
}
if ( ! $date_dir ) {
// OK, no db value found. Create structure from filename.
$random_string = substr ( $photo [ 'filename' ], - 6 , 6 );
$time = str_replace ( $random_string , '' , $photo [ 'filename' ] );
$date_dir = date ( 'Y/m/d' , $time );
2012-09-11 07:05:29 +00:00
// Make sure the file exists @PHOTOS_DIR.'/'.$date_dir.'/'.$photo['filename'].'.'.$photo['ext']
2012-05-29 11:53:39 +00:00
if ( ! file_exists ( PHOTOS_DIR . '/' . $date_dir . '/' . $photo [ 'filename' ] . '.' . $photo [ 'ext' ] ) ) {
$date_dir = false ;
2012-09-11 07:05:29 +00:00
} else {
// Update the db value
2012-12-18 12:11:12 +00:00
$db -> update ( tbl ( 'photos' ), array ( 'file_directory' ), array ( $date_dir ), " photo_id = ' " . $photo [ 'photo_id' ] . " ' " );
2012-09-11 07:05:29 +00:00
}
2012-05-29 11:53:39 +00:00
}
return $date_dir ;
}
2012-07-02 07:05:39 +00:00
2012-09-13 12:18:39 +00:00
/**
* Alias function to create view photo link
*
* @ global OBJECT $cbphoto
* @ param ARRAY $photo
* @ param STRING $type
* @ return STRING
*/
2012-07-02 07:05:39 +00:00
function view_photo_link ( $photo , $type = 'view_item' ) {
global $cbphoto ;
return $cbphoto -> collection -> collection_links ( $photo , $type );
}
2012-07-18 22:38:02 +00:00
2012-09-13 12:18:39 +00:00
/**
* This function adds a new link in options for each at photos manager .
* Callback is still in not working . I want to register both link and it ' s callback
* using same function .
*
* PROBLEM :-
* Problem is calling the callback function for certain link . Even if i figure out
* a way to determine which callback to call , it will not be called because these
* new links are being added inside display_manager_links () which is being called
* inside smarty file .
*
* SOLUTION :- ( to me , for the time being )
* We don ' t use filters to add new links . Just calling add_photo_manager_link will
* add new link inside $cbphoto -> manager_links , so at admin_area / photo_manager . php
* every link exists inside manager_links .
*
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
* FINAL :-
* Like my proposed solution . calling this function will do following
* |- Add new item in manager_links array
* |- Create a callback_id if callback exists using $callback . $link . $title and hashing with md5
* |- Add it ' s callback_id if exists into manager_link_callbacks array
*
* To get details of each photo for link , you must use a function to create the link . Pass any
* argument to function and it will hold details of each photo , e . g
*
* function create_manager_link ( $p ) {
* return '?_key' . $p [ 'photo_key' ];
* }
*
2012-09-13 12:18:39 +00:00
* @ global OBJECT $cbphoto
* @ param STRING $title
* @ param STRING $link
* @ param STRING $callback
2012-10-03 19:00:29 +00:00
* @ param BOOLEAN $front_end
2012-09-13 12:18:39 +00:00
* @ return MIX
*/
2012-10-03 19:00:29 +00:00
function add_photo_manager_link ( $title , $link , $callback = false , $front_end = false ) {
2012-07-18 22:38:02 +00:00
global $cbphoto ;
2012-09-14 09:46:27 +00:00
2012-07-18 22:38:02 +00:00
if ( ! $title || ! $link ) {
return false ;
}
2012-10-03 19:00:29 +00:00
/* Check which end we are adding this link */
$which_end = ( $front_end === true ) ? 'front_end' : 'back_end' ;
2012-09-14 09:46:27 +00:00
2012-10-03 19:00:29 +00:00
// Create callback id
2012-09-14 09:46:27 +00:00
if ( $callback ) {
2012-10-03 19:00:29 +00:00
$callback_id = md5 ( $callback . $link . $which_end . SEO ( strtolower ( $title )) );
2012-09-14 09:46:27 +00:00
}
2012-10-03 19:00:29 +00:00
$cbphoto -> manager_links [ $which_end ][] = array (
2012-07-18 22:38:02 +00:00
'title' => $title ,
2012-10-03 19:00:29 +00:00
'id' => SEO ( strtolower ( $title )) . '-' . time (),
2012-07-18 22:38:02 +00:00
'link' => $link ,
'args' => $args ,
2012-09-14 09:46:27 +00:00
'callback' => $callback ,
'callback_id' => $callback_id
2012-07-18 22:38:02 +00:00
);
2012-09-14 09:46:27 +00:00
// Add callback
if ( $callback ) {
$cbphoto -> manager_link_callbacks [ $callback_id ] = $callback ;
}
2012-10-03 19:00:29 +00:00
return $cbphoto -> manager_links ;
2012-07-18 22:38:02 +00:00
}
2012-09-13 12:18:39 +00:00
/**
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
* Function displays the photo manager links . Here we will check if link
* is function or simple string . If function , call it and return the result .
* Than if callback exists , append it ' s id at end of returned result .
*
* filter used : photo_manager_links
2012-09-13 12:18:39 +00:00
*
* @ global OBJECT $cbphoto
* @ param type $photo
* @ return string
*/
2012-10-03 19:00:29 +00:00
function display_manager_links ( $photo , $front_end = false ) {
2012-07-18 22:38:02 +00:00
global $cbphoto ;
2012-10-03 19:00:29 +00:00
$which_end = ( $front_end === true || FRONT_END ) ? 'front_end' : 'back_end' ;
$links = $cbphoto -> manager_links [ $which_end ];
2012-07-18 22:38:02 +00:00
$links = apply_filters ( $links , 'photo_manager_links' );
2012-09-14 09:46:27 +00:00
2012-07-18 22:38:02 +00:00
if ( $links ) {
foreach ( $links as $link ) {
2012-09-14 09:46:27 +00:00
// Creating link. Either function or string
if ( function_exists ( $link [ 'link' ]) && is_string ( $link [ 'link' ]) ) {
$url = $link [ 'link' ] ( $photo );
} else {
$url = $link [ 'link' ];
}
2012-10-03 19:00:29 +00:00
if ( ! $url ) {
continue ; // Skip this index
}
if ( is_array ( $url ) ) {
/* Sometimes we need to change title according to conditions . Return array with title and link
* indexes in your function to do so . For example return result should be like following :
*
* function name () {
* ..........
* ........
* ....
* ..
* .
* return array ( 'title' => 'New title' , 'link' => 'your_link' );
* }
*
*/
$link [ 'title' ] = $url [ 'title' ] ? $url [ 'title' ] : $link [ 'title' ];
2012-11-27 11:56:45 +00:00
$url = $url [ 'link' ] ? $url [ 'link' ] : $link [ 'link' ];
2012-10-03 19:00:29 +00:00
}
Updated : upgrade_3.0.sql
Updated : edit_account.php, Now when avatar is set it redirects to user profile
Updated : EXIF Data url
Updated : queryString function regex. Old one was removing complete query string
Updated : display_manager_links(), now all variables except omo are removed from url
Added : Make profile link for photos @startup.php
Added : return_object_order in template_functions.php, This returns the order of provided omo value
Updated : Order checking @manage_collections.php and @manage_photos.php. Now only return_object_order is used
Updated : Updating of photo when it is uploaded
Updated : photo.html, single_feed.html, single_feed_comment.html, photo_form.html, user.html, video.html, /view_channel/feed.html, manage_photos.html, view_channel.html
Added : user_contacts.html, user_photos.html and user_videos.html
Added : autoComplete parameter for photo tagging
Updated : default.css, feeds.css and view_channel.css
Updated : user_contacts.php
Added : Next and Previous photos links @view_item.php
Fixed : Avatar Delete
Fixed : getProfileItem method of $userquery
2012-12-04 13:27:13 +00:00
if ( $_SERVER [ 'QUERY_STRING' ] && strpos ( $url , '.php' ) === false && strpos ( $url , '?' ) !== false ) {
2012-11-27 11:56:45 +00:00
// QUERY_STRING exists and $url does not have .php
2012-10-03 19:00:29 +00:00
// append QUERY_STRING before $url
$url = ltrim ( $url , '?' ); // removing the ? from start of string
parse_str ( $url , $variables ); // changing $url query string to array
Updated : upgrade_3.0.sql
Updated : edit_account.php, Now when avatar is set it redirects to user profile
Updated : EXIF Data url
Updated : queryString function regex. Old one was removing complete query string
Updated : display_manager_links(), now all variables except omo are removed from url
Added : Make profile link for photos @startup.php
Added : return_object_order in template_functions.php, This returns the order of provided omo value
Updated : Order checking @manage_collections.php and @manage_photos.php. Now only return_object_order is used
Updated : Updating of photo when it is uploaded
Updated : photo.html, single_feed.html, single_feed_comment.html, photo_form.html, user.html, video.html, /view_channel/feed.html, manage_photos.html, view_channel.html
Added : user_contacts.html, user_photos.html and user_videos.html
Added : autoComplete parameter for photo tagging
Updated : default.css, feeds.css and view_channel.css
Updated : user_contacts.php
Added : Next and Previous photos links @view_item.php
Fixed : Avatar Delete
Fixed : getProfileItem method of $userquery
2012-12-04 13:27:13 +00:00
parse_str ( $_SERVER [ 'QUERY_STRING' ], $server_variables );
2012-10-03 19:00:29 +00:00
if ( $variables ) {
$query_string_variables = array_keys ( $variables ); // extracting only names of variables
Updated : upgrade_3.0.sql
Updated : edit_account.php, Now when avatar is set it redirects to user profile
Updated : EXIF Data url
Updated : queryString function regex. Old one was removing complete query string
Updated : display_manager_links(), now all variables except omo are removed from url
Added : Make profile link for photos @startup.php
Added : return_object_order in template_functions.php, This returns the order of provided omo value
Updated : Order checking @manage_collections.php and @manage_photos.php. Now only return_object_order is used
Updated : Updating of photo when it is uploaded
Updated : photo.html, single_feed.html, single_feed_comment.html, photo_form.html, user.html, video.html, /view_channel/feed.html, manage_photos.html, view_channel.html
Added : user_contacts.html, user_photos.html and user_videos.html
Added : autoComplete parameter for photo tagging
Updated : default.css, feeds.css and view_channel.css
Updated : user_contacts.php
Added : Next and Previous photos links @view_item.php
Fixed : Avatar Delete
Fixed : getProfileItem method of $userquery
2012-12-04 13:27:13 +00:00
$server_string_variables = array_keys ( $server_variables );
if ( $query_string_variables ) {
$query_string_variables = ( array_merge ( $query_string_variables , $server_string_variables ) );
$query_string_variables = array_unique ( $query_string_variables );
$query_string_variables = array_diff ( $query_string_variables , array ( 'omo' ) );
//pr( $query_string_variables, true );
$query_string = queryString ( null , $query_string_variables );
}
//echo $query_string."<br/>";
2012-10-03 19:00:29 +00:00
$url = $query_string . $url ;
}
}
2012-09-14 09:46:27 +00:00
// Appeding callback_id if callback exists
if ( $link [ 'callback' ] ) {
if ( strpos ( $url , '?' ) !== false ) {
$url .= '&callback_id=' . $link [ 'callback_id' ];
} else {
$url .= '?callback_id=' . $link [ 'callback_id' ];
}
2012-07-18 22:38:02 +00:00
}
2012-09-14 09:46:27 +00:00
2012-10-03 19:00:29 +00:00
if ( $link [ 'args' ] && is_array ( $link [ 'args' ]) ) {
$attributes = '' ;
foreach ( $link [ 'args' ] as $attribute => $value ) {
$attributes .= $attribute . " =' " . $value . " ' " ;
}
}
$output .= '<li><a id="' . $link [ 'id' ] . '" href="' . $url . '" ' . $attributes . '>' . $link [ 'title' ] . '</a></li>' ;
2012-07-18 22:38:02 +00:00
}
return $output ;
}
}
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
/**
* Function calls the provided callback_id callback function . Using callback_id
* insures that no fasool calls are made . Only callacbk is called whos id is provided .
* callback_id is required to make to call .
2012-10-03 19:00:29 +00:00
*
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
* @ global OBJECT $cbphoto
*/
2012-09-14 09:46:27 +00:00
function photo_manager_link_callbacks () {
global $cbphoto ;
$callbacks = $cbphoto -> manager_link_callbacks ;
if ( $callbacks ) {
// Check if callback id is exists
if ( $_GET [ 'callback_id' ] ) {
$callback_id = mysql_clean ( $_GET [ 'callback_id' ] );
// Get current function callback function
if ( ! empty ( $cbphoto -> manager_link_callbacks [ $callback_id ] ) ) {
if ( function_exists ( $cbphoto -> manager_link_callbacks [ $callback_id ] ) ) {
$cbphoto -> manager_link_callbacks [ $callback_id ]();
}
}
}
}
}
2012-09-13 12:18:39 +00:00
/**
* Fetchs photo_plupload template
* @ return STRING
*/
2012-09-11 07:05:29 +00:00
function load_photo_plupload_block () {
$template = fetch ( MODULES_DIR . '/uploader/photo_pluploader.html' , false );
return $template ;
}
2012-09-13 12:18:39 +00:00
/**
* Function will be all embed types registered for photos
*
* @ global OBJECT $cbphoto
* @ return ARRAY
*/
function get_photo_embeds () {
global $cbphoto ;
return $cbphoto -> embed_types ;
}
/**
* Function will add a new embed type in photo embed_types array .
* $name , $id and $callback is required to register successfully . $id
* needs to be a unique one . If your embed code is not showing there
* are two possibilities . Either $id already exists or $callback function
* does not exist .
*
* In your callback function you will format your embed code . You
* can use few embed code templates given below , related to image :
* % IMAGE_URL % - this will be replaced with image url path
* % IMAGE_WIDTH % - this will be replaced with image width
* % IMAGE_HEIGHT % - this will be replaced with image height .
*
* Example of callback :
* return " <a href='view_photo_link( $photo )' target='_blank'><img src='%IMAGE_URL%' width='%IMAGE_WIDTH%' height='%IMAGE_HEIGHT%' /></a> " ;
*
* @ global OBJECT $cbphoto
* @ param STRING $name
* @ param STRING $id
* @ param STRING $callback
* @ param STRING $description
* @ return ARRAY
*/
function add_photo_embed_type ( $name , $id , $callback , $description = null ) {
global $cbphoto ;
$embeds = $cbphoto -> embed_types ;
if ( $embeds [ $id ] || ! function_exists ( $callback ) ) {
//Embed code already exists with given id or
// callback function provided does not exist
return ;
}
2012-11-27 11:56:45 +00:00
$cbphoto -> embed_types [ $id ] = array (
2012-09-13 12:18:39 +00:00
'name' => $name ,
'callback' => $callback ,
'id' => $id ,
'description' => $description
);
return $cbphoto -> embed_types ;
}
/**
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
* Previous function has been replaced with this one .
2012-09-13 12:18:39 +00:00
* ---------------------------------------------------------
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
* This function will be construct any array of embed codes with
2012-09-13 12:18:39 +00:00
* there repesctive embed codes . It will also check if photo details
* are given , any embed code has registered or not and if photo
* has allowed photo embedding and display message accordingly .
*
* This will also add embed code in photo_embed_templates array .
* These will be used in javascript to change to image url , width
* and height .
*
* @ global OBJECT $cbphoto
* @ param ARRAY $params
* @ return ARRAY
*/
function photo_embed_codes ( $params = null ) {
global $cbphoto ;
if ( is_array ( $params ) ) {
$photo = $params [ 'details' ];
} else {
$photo = $params ;
}
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
$params [ 'display_error' ] = $params [ 'display_error' ] ? $params [ 'display_error' ] : 'yes' ;
2012-09-13 12:18:39 +00:00
$embeds = get_photo_embeds ();
if ( empty ( $photo ) ) {
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
if ( $params [ 'display_error' ] == 'yes' ) {
echo '<p>' . lang ( " Unable to create embed codes. Photo details not available " ) . '</p>' ;
}
2012-09-13 12:18:39 +00:00
return ;
} else if ( empty ( $embeds ) ) {
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
if ( $params [ 'display_error' ] == 'yes' ) {
echo '<p>' . lang ( " Unable to create embed codes. No photo embed code registered " ) . '</p>' ;
}
2012-09-13 12:18:39 +00:00
return ;
} else if ( $photo [ 'allow_embedding' ] == 'no' ) {
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
if ( $params [ 'display_error' ] == 'yes' ) {
echo '<p>' . lang ( " Photo embedding is disabled by user. " ) . '</p>' ;
}
2012-09-13 12:18:39 +00:00
return ;
} else {
$remove = $params [ 'remove' ];
if ( $remove ) {
$remove = explode ( ',' , $remove ); // Separate them using ','
$remove = array_map ( 'trim' , $remove ); // Remove any space around string
foreach ( $remove as $R ) {
if ( $embeds [ $R ] ) {
unset ( $embeds [ $R ] );
}
}
}
foreach ( $embeds as $id => $embed ) {
$code = $embed [ 'callback' ]( $photo );
$embeds [ $id ][ 'code' ] = $code ;
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
// Setting up default size.
$size = $params [ 'size' ] ? $params [ 'size' ] : 'm' ;
$pd = json_decode ( $photo [ 'photo_details' ], true );
$size_details = $pd [ $size ];
$embeds [ $id ][ 'code' ] = str_replace ( array ( '%IMAGE_URL%' , '%IMAGE_WIDTH%' , '%IMAGE_HEIGHT%' ), array ( $cbphoto -> get_image_file ( $photo , $size ), $size_details [ 'width' ], $size_details [ 'height' ] ), $code );
2012-09-13 12:18:39 +00:00
$cbphoto -> photo_embed_templates [ $embed [ 'id' ] ] = $code ;
}
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
2012-09-13 12:18:39 +00:00
return $embeds ;
}
}
/**
* This will list avaiable photo sizes . By default following are created :
* Thumb | code - t
* Medium | code - m
* Large | code - l
* Original | code - p
* ---------------------------------
* If from plugin or @ startup . php more thumbs are added and current
* photo has custom thumbs , those dimensions will also be displayed here .
*
* If photo has custom thumb but it ' s has been removed from thumb_dimensions
* array ( e . g plugin is deactivate ), only it ' s dimensions will be displayed .
*
* @ global OBJECT $cbphoto
* @ param ARRAY $photo
* @ return ARRAY
*/
function display_photo_embed_sizes ( $photo ) {
global $cbphoto ;
$dimensions = $cbphoto -> thumb_dimensions ;
$pd = json_decode ( $photo [ 'photo_details' ], true );
foreach ( $pd as $code => $size ) {
$sort [ $code ] = $size [ 'width' ];
}
asort ( $sort , SORT_NUMERIC );
foreach ( $sort as $code => $width ) {
$_pd = $pd [ $code ];
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
$output .= '<li data-url="' . $cbphoto -> get_image_file ( $photo , $code ) . '" data-code="' . $code . '" data-width="' . $_pd [ 'width' ] . '" data-height="' . $_pd [ 'height' ] . '" data-size="' . $_pd [ 'size' ][ 'bytes' ] . '" class="toggle-photo-size"><a href="javascript:void(0)">' . $_pd [ 'width' ] . ' x ' . $_pd [ 'height' ] . '</a></li>' ;
2012-09-13 12:18:39 +00:00
}
return $output ;
}
/**
* HTML Embed code callback
* @ param ARRAY $photo
* @ return string
*/
function photo_html_code ( $photo ){
2012-11-27 11:56:45 +00:00
$output = " <a href=' " . view_photo_link ( $photo ) . " ' target='_blank'><img src='%IMAGE_URL%' border='0' width='%IMAGE_WIDTH%' height='%IMAGE_HEIGHT%' alt=' " . $photo [ 'photo_title' ] . " by " . $photo [ 'username' ] . " on " . TITLE . " ' /></a> " ;
2012-09-13 12:18:39 +00:00
return $output ;
}
/**
* BB Embed code callback
* @ param ARRAY $photo
* @ return string
*/
function photo_bb_code ( $photo ) {
return " [IMG=%IMAGE_URL%] " ;
}
/**
* Email Embed code callback
* @ param ARRAY $photo
* @ return string
*/
function photo_email_code ( $photo ) {
return view_photo_link ( $photo );
}
/**
* BB Linked Embed code callback
* @ param ARRAY $photo
* @ return string
*/
function photo_bb_code_linked ( $photo ) {
return " [URL= " . view_photo_link ( $photo ) . " ][IMG=%IMAGE_URL%][/URL] " ;
}
/**
* BB Alt Embed code callback
* @ param ARRAY $photo
* @ return string
*/
function photo_bb_code_alt ( $photo ) {
return " [IMG]%IMAGE_URL%[/IMG] " ;
}
/**
* BB Alt Linked Embed code callback
* @ param ARRAY $photo
* @ return string
*/
function photo_bb_code_alt_linked ( $photo ) {
return " [URL= " . view_photo_link ( $photo ) . " ][IMG]%IMAGE_URL%[/IMG][/URL] " ;
}
Fixed : Mass Recreation of photos
Fixed : Uploading/Making/Changing user avatar will also update collection cover to current one
Fixed : $crop variable to $cropping in generate_photos. In resizer.class.php we are using $cropping
Added : New cropping case, 10. Read it's example to understand what it does
Added : Documentation for few function in functions_photos.php
Added : new function called display_user_custom_background in functions_users.php
Added : Custom Dimensions for photos in startup.php. Now these will also be produced, 75x75,100x100,150x150,240,320,500,640,800,1024
Updated : default.css
Added : new display_method in blocks/video.html
Added : Change background form
Fixed : photo embed code
2012-09-26 12:35:05 +00:00
function photo_direct_link ( $photo ) {
return '%IMAGE_URL%' ;
}
2012-10-03 19:00:29 +00:00
/**
* Gets photo manager orders
*
* @ return ARRAY
*/
function get_photo_manager_orders () {
return object_manager_orders ( 'photo' );
}
/**
* Adds photo manager order
*
* @ param STRING $title Title of order
* @ param STRING $order mySQL order
* @ param STRING $id Optional
* @ return MIX
*/
2012-11-27 11:56:45 +00:00
function add_photo_manager_order ( $title , $order , $id = false ) {
2012-10-03 19:00:29 +00:00
return add_object_manager_order ( $title , $order , 'photo' , $id );
}
/**
* Displays photo manager order
*
* @ param STRING $display
* @ return MIX
*/
function display_photo_manger_orders ( $display = 'unselected' ) {
return display_manager_orders ( 'photo' , $display );
}
/**
* Displays current photo manager order
*
* @ return STRING
*/
function current_photo_order () {
return current_object_order ( 'photo' );
}
2012-03-17 13:08:28 +00:00
?>