Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (32 sloc) 1.36 KB
<?php
/**
* @file
* Code for the fishers_theme feature.
*/
include_once 'fishers_theme.features.inc';
/**
* Implements hook_user_presave().
*
* Merges two user profile photos into one and saves that as the theme's logo.
*/
function fishers_theme_user_presave(&$edit, $account, $category) {
if ($category == 'account' && isset($edit['picture_upload']) && ($account->name == 'ghalidrim' || $account->name == 'mariacha')) {
$taylor_pic = $account->name == 'ghalidrim' ? image_load($edit['picture_upload']->uri) : image_load(user_load_by_name('ghalidrim')->picture->uri);
$maria_pic = $account->name == 'mariacha' ? image_load($edit['picture_upload']->uri) : image_load(user_load_by_name('mariacha')->picture->uri);
if(!$maria_pic) {
$maria_pic = $taylor_pic;
}
image_gd_crop($maria_pic, 0, 0, $maria_pic->info['width'] * 2, $maria_pic->info['height']);
imagecopymerge($maria_pic->resource, $taylor_pic->resource, $maria_pic->info['width'] / 2, 0, 0, 0, $taylor_pic->info['width'], $taylor_pic->info['height'], 100);
$sky_settings = variable_get('theme_sky_settings');
image_gd_save($maria_pic, $sky_settings['logo_path']);
}
}
/**
* Implements hook_init().
*
* Adds a few styles to the default.
*/
function fishers_theme_init() {
drupal_add_css(drupal_get_path('module', 'fishers_theme') . '/css/alterations.css');
}