Created
May 25, 2013 10:16
-
-
Save aristath/5648600 to your computer and use it in GitHub Desktop.
In response to http://premium.wpmudev.org/forums/topic/subsite-theme-upload-image-default-location#post-431984
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fileid = null; | |
// If this is a multisite installation, append the blogid to the filename | |
if ( is_multisite() ) { | |
global $blog_id; | |
if ( $blog_id > 1 ) | |
$fileid = '_id-' . $blog_id; | |
else | |
$fileid = null; | |
} | |
$filename = 'photo' . $fileid . '.jpg'; | |
?> | |
<div class="profile-picture" id="photoChange"> | |
<img alt="profile picture" src="<?php echo get_template_directory_uri() ?>/images/<?php echo $filename; ?>?<?php echo md5(microtime()); ?>" /> | |
<span class="border"></span> | |
<a href="#" class="change"><?php _e('Change', $shortname); ?> 153x186</a> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fileid = null; | |
// If this is a multisite installation, append the blogid to the filename | |
if ( is_multisite() ) { | |
global $blog_id; | |
if ( $blog_id > 1 ) | |
$fileid = '_id-' . $blog_id; | |
else | |
$fileid = null; | |
} | |
$filename = 'photo' . $fileid . '.jpg'; | |
?> | |
<div class="about"> | |
<div class="photo-inner"><img src="<?php echo get_template_directory_uri(); ?>/images/<?php echo $filename; ?>" height="186" width="153" /></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Profile picture | |
}else if(isset($_FILES['photo'])) { | |
$fileid = null; | |
// If this is a multisite installation, append the blogid to the filename | |
if ( is_multisite() ) { | |
global $blog_id; | |
if ( $blog_id > 1 ) | |
$fileid = '_id-' . $blog_id; | |
else | |
$fileid = null; | |
} | |
$filename = 'photo' . $fileid . '.jpg'; | |
$file = &$_FILES['photo']; | |
$allowedExt = array('jpg', 'png', 'jpeg', 'gif'); | |
$destination = RBISTA_IMAGES.DS.$filename; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment