RogerB Posted July 20, 2012 Report Posted July 20, 2012 Instead of just showing a drop down for Signature banners, I would like to also show a preview of the sig ban. Anyone ever done this? Quote
RogerB Posted July 20, 2012 Author Report Posted July 20, 2012 Really I never understood the point of making a selection for a signature banner you can't preview........ Quote
SouthwestVA Posted July 22, 2012 Report Posted July 22, 2012 yeah edit the tpl, ill post mine, give me an hour Quote
SouthwestVA Posted July 22, 2012 Report Posted July 22, 2012 <h3>Edit Profile</h3> <form action="<?php echo url('/profile');?>" method="post" enctype="multipart/form-data"> <dl> <dt>Name</dt> <dd><?php echo $userinfo->firstname . ' ' . $userinfo->lastname;?></dd> <dt>Airline</dt> <dd><?php echo $userinfo->code?> <p>To request a change, contact your admin</p> </dd> <dt>Email Address</dt> <dd><input type="text" name="email" value="<?php echo $userinfo->email;?>" /> <?php if(isset($email_error) && $email_error == true) echo '<p class="error">Please enter your email address</p>'; ?> </dd> <dt>Location</dt> <dd><select name="location"> <?php foreach($countries as $countryCode=>$countryName) { if($userinfo->location == $countryCode) $sel = 'selected="selected"'; else $sel = ''; echo '<option value="'.$countryCode.'" '.$sel.'>'.$countryName.'</option>'; } ?> </select> <?php if(isset($location_error) && $location_error == true) echo '<p class="error">Please enter your location</p>'; ?> </dd> <dt>Signature Background</dt> <dd><select name="bgimage"> <?php foreach($bgimages as $image) { if($userinfo->bgimage == $image) $sel = 'selected="selected"'; else $sel = ''; echo '<option value="'.$image.'" '.$sel.'>'.$image.'</option>'; } ?> </select> </dd> <?php if($customfields) { foreach($customfields as $field) { echo '<dt>'.$field->title.'</dt> <dd>'; if($field->type == 'dropdown') { $field_values = SettingsData::GetField($field->fieldid); $values = explode(',', $field_values->value); echo "<select name=\"{$field->fieldname}\">"; if(is_array($values)) { foreach($values as $val) { $val = trim($val); if($val == $field->value) $sel = " selected "; else $sel = ''; echo "<option value=\"{$val}\" {$sel}>{$val}</option>"; } } echo '</select>'; } elseif($field->type == 'textarea') { echo '<textarea class="customfield_textarea"></textarea>'; } else { echo '<input type="text" name="'.$field->fieldname.'" value="'.$field->value.'" />'; } echo '</dd>'; } } ?> <dt>Avatar:</dt> <dd><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo Config::Get('AVATAR_FILE_SIZE');?>" /> <input type="file" name="avatar" size="40"> <p>Your image will be resized to <?php echo Config::Get('AVATAR_MAX_HEIGHT').'x'.Config::Get('AVATAR_MAX_WIDTH');?>px</p> </dd> <dt>Current Avatar:</dt> <dd><?php if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png')) { echo 'None selected'; } else { ?> <img src="<?php echo SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png';?>" /></dd> <?php } ?> <dt></dt> <dd><input type="hidden" name="action" value="saveprofile" /> <input type="submit" name="submit" value="Save Changes" /></dd> </dl> </form> <h3>Sig Background Previews</h3> <img src="blah" /><br /> add a img tag with your options, thats what i did. <h3>Sig Background Previews</h3> <img src="blah" /><br /> 1 Quote
RogerB Posted July 22, 2012 Author Report Posted July 22, 2012 I want a preview of the drop down menu, so you can see what you're selecting before you save it. Quote
RogerB Posted July 22, 2012 Author Report Posted July 22, 2012 That doesn't work, and the avatar doesn't show. Quote
RogerB Posted July 22, 2012 Author Report Posted July 22, 2012 This is what I want, when a user pics a banner from the drop down they get a preview under it. See picture below. Quote
Administrators Nabeel Posted July 24, 2012 Administrators Report Posted July 24, 2012 To this <select name="bgimage"> make it: <select name="bgimage" id="bgimage"> Then at the matching </select>, after it add: <div id="preview_image"></div> Then at the bottom of the template: <script type="text/javascript"> $("#bgimage").bind('change', function() { var image = $(this).val(); $("#preview_image").html("<img src='/lib/signatures/" + image + "' />"); }); </script> The /lib/signatures path is probably wrong. But it's something like that, more than enough to start with... I just wrote it out and haven't tested it so... Basically it's using jQuery to bind to a change event on the select box, then when it changes, it adds the img tag into the div that was added to show the preview. Quote
RogerB Posted July 25, 2012 Author Report Posted July 25, 2012 Works great!! for all that use it all that was wrong is the path here is the correct code. <script type="text/javascript"> $("#bgimage").bind('change', function() { var image = $(this).val(); $("#preview_image").html("<img src='/lib/signatures/background/" + image + "' />"); }); </script> 1 Quote
Remington Box Posted May 13, 2013 Report Posted May 13, 2013 Maybe I am a blithering idiot... but I cannot get anything to show up in the select box... Here is my code and I have the <script> that Nabeel and RogerB edited posted at the bottom of the template <select name="bgimage" id="bgimage"> <?php foreach($bgimages as $image) { if($userinfo->bgimage == $image) $sel = 'selected="selected"'; else $sel = ''; echo '<option value="'.$image.'" '.$sel.'>'.$image.'</option>'; } ?> </select> <div id="preview_image"></div> Quote
freshJet Posted May 14, 2013 Report Posted May 14, 2013 What is in your lib/signatures/background folder? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.