[Plugin: Cimy User Extra Fields] display picture or thumbnail multisite
-
I am running multisite 3.0.5. I wanted to give my users a sort of per blog sub header image so I created a picture cimy extra field. I want the images to fit the themes left column so I set the max width of the picture to 620pixels. If someone uploads a larger pic a thumbnail is created at the 620pixel size. So now I want to show this pic or thumbnail but only if they uploaded one. this is the code I came up with:
<?php $thisblog_admin = $current_blog->blog_id; $user_id_from_email = get_user_id_from_string( get_blog_option($thisblog_admin, 'admin_email')); $logo_image_url = get_cimyFieldValue($user_id_from_email, logo ); $logo_thumb_url_test = cimy_get_thumb_path($logo_image_url); $handle_logo = @fopen($logo_thumb_url_test,'r'); if($handle_logo !== false){ $logo_thumb_url = cimy_get_thumb_path($logo_image_url); } else{ $logo_thumb_url = $logo_image_url; } if(!empty($logo_thumb_url)) echo '<a href="'.get_option('home').'/"><center><img src="'.$logo_thumb_url.'"Our Site Logo/></center>'; ?>
It seemed fine. but it creates problems that suck up cpu and memory and crash the server. Is there a better way to show the image, but thumbnail if it exists, but only if there is one ( in IE/Chrome if the user doesn’t upload anything you see the little broken image placeholder)
- The topic ‘[Plugin: Cimy User Extra Fields] display picture or thumbnail multisite’ is closed to new replies.