<%
var no_back_logo = "undefined" == typeof(back_logo) || _.isEmpty(back_logo);
if(is_admin && tpl != 'te' && gradient_objects.length > 0) {
var orientation = 'square';
var print_w = parseInt(print_w);
var print_h = parseInt(print_h);
var ratio = (print_w > 0 && print_h > 0) ? (print_w/print_h) : (web_w/web_h);
if(ratio > 1) {
orientation = 'horizontal';
} else if(ratio < 1) {
orientation = 'vertical';
}
var extra_class = side != 'front' ? ' ABOVE_PHOTO' : '';
_.each(gradient_objects, function(data, key){
data = data.toJSON();
%>
<% })}; %>
<% if("undefined" != typeof(barcode_overlays_path) && !_.isEmpty(barcode_overlays_path)){ %>

<%
}%>
<% if("undefined" != typeof(grid_path) && !_.isEmpty(grid_path) && (_.isUndefined(is_gift_tag) || !is_gift_tag)){ %>

<% } %>
<%
if( baseView.checkFeature('shape') ) {
%>
<%
}
%>
<%
if(!_.isEmpty(template_img) && $.inArray(caption.toLowerCase(), ucd_config.sides_has_template) != -1){
template_img += '?v=' + publish_version;
%>

/>
<%
}
if(side == 'back') {
var back_logo_src = typeof(back_logo) != 'undefined' && back_logo ? UCD_S3_BUCKET+'/back_logo/'+back_logo+'?v=3' : '';
var back_logo_style = typeof(back_logo) != 'undefined' && back_logo ? 'position: absolute;' : 'position: absolute;display:none;';
%>

<%
}
if("undefined" != typeof(foil_path) && !_.isEmpty(foil_path) && side == 'front'){
%>

<%
}
if(typeof die_cut != 'undefined' && !_.isEmpty(die_cut) && 0 != die_cut){
die_cut = addUrlRandom(die_cut);
if(is_admin) die_cut = 'admin/'+die_cut;
%>

<%
}
else if("undefined" != typeof(photo_easel_file_name) && !_.isEmpty(photo_easel_file_name)){
%>

<%
}
var photo_num = photo_objects.length;
_.each(photo_objects, function(data, key){
data = data.toJSON();
var resize_x = parseFloat(data.x);
var resize_y = parseFloat(data.y);
var resize_w = parseFloat(data.w);
var resize_h = parseFloat(data.h);
if(resize_x <= edge_mask_width){
resize_w -= edge_mask_width - resize_x;
resize_x = edge_mask_width;
}
if(resize_y <= edge_mask_width){
resize_h -= edge_mask_width - resize_y;
resize_y = edge_mask_width;
}
if(resize_x + resize_w > web_w - edge_mask_width*2){
resize_w = web_w - resize_x - edge_mask_width;
}
if(resize_y + resize_h > web_h - edge_mask_width*2){
resize_h = web_h - resize_y - edge_mask_width;
}
var is_full = photo_num==1 && (data.w>=web_w || data.h>=web_h) ? 1 : 0;
var valid_photo = !_.isEmpty(data.file) && !/^[\d]+\.jpg$/i.test(data.file) ? 1 : 0;
var slot_size = '';
if (resize_w<70 || resize_h<70) {
slot_size = 'SMALL4';
} else if (resize_w<100 || resize_h<80) {
slot_size = 'SMALL3';
} else if (resize_w<=120 || resize_h<100) {
slot_size = 'SMALL2';
} else if (resize_w<=135 || resize_h<120) {
slot_size = 'SMALL1';
}
%>
<% if( ! baseView.checkFeature('drag_drop_upload') ) { %>
DRAG PHOTO
FROM LEFT TRAY
TO INSERT
<% } %>
<% if ( baseView.checkFeature('drag_drop_upload') ) { %>
<% } %>
<% });%>
<%
if(raster_objects.length > 0) {
_.each(raster_objects, function(data, key){
data = data.toJSON();
if( raster_objects.length > 1 && parseInt(data.is_default) == 0 || data.disabled) {
return;
}
%>
<%
});
}
%>
<%
_.each(text_objects, function(data, key){
data = data.toJSON();
if( data.is_multiple == 1 && (data.disabled || ((default_editable_greeting && data.is_default != 1) || (!default_editable_greeting && data.id != editable_greetings[0].get('id')))) ) {
return;
}
%>
Insert Text Here
<% });%>
<%
if(typeof asset_objects != 'undefined'){
_.each(asset_objects, function(data, key){
data = data.toJSON();
var zoom = parseFloat(data.zoom);
var asset_w = parseFloat(data.w);
var asset_h = parseFloat(data.h);
var is_back_logo = _.isUndefined(data.is_back_logo) ? 0 : parseInt(data.is_back_logo);
var zoom_asset_w = asset_w * zoom;
var zoom_asset_h = asset_h * zoom;
if (zoom_asset_w<1) zoom_asset_w = 1;
if (zoom_asset_h<1) zoom_asset_h = 1;
if (is_back_logo && !_.isEmpty(data.file) && site_id != 2) data.file = data.file.replace('web', 'print');
if( _.isUndefined(data.is_logo) || data.is_logo == 1 ) {
%>
<% } else if(is_back_logo != 1 || is_back_logo==1 && 1!=hide_back_logo && no_back_logo) { %>
<% } %>
<% }); }%>
<%
if(typeof knock_out != 'undefined' && !_.isEmpty(knock_out)) {
var knockout_width = overlay_w;
var knockout_height = Math.round(overlay_h);
var knockout_marginleft = overlay_offset_x;
var knockout_margintop = overlay_offset_y;
if( baseView.isResponsive() ) {
knockout_width += 2;
knockout_height += 2;
knockout_marginleft -= 1;
knockout_margintop -= 1;
}
%>
<% if( !baseView.checkIfSupportTextWrap() ) { %>
Click to Edit
<% } %>
Warning, click here
<% });%>
<%
_.each(asset_objects, function(data, key){
data = data.toJSON();
var resize_x = parseFloat(data.x);
var resize_y = parseFloat(data.y);
var resize_w = parseFloat(data.w);
var resize_h = parseFloat(data.h);
if(resize_x <= 0){
resize_x = edge_mask_width;
resize_w -= resize_x;
}
if(resize_y <= 0){
resize_y = edge_mask_width;
resize_h -= resize_y;
}
if(resize_x + resize_w > web_w - edge_mask_width*2){
resize_w = web_w - resize_x - edge_mask_width;
}
if(resize_y + resize_h > web_h - edge_mask_width*2){
resize_h = web_h - resize_y - edge_mask_width;
}
if (resize_w<1) resize_w = 1;
if (resize_h<1) resize_h = 1;
var diff_x = resize_x - parseFloat(data.x);
var diff_y = resize_y - parseFloat(data.y);
var is_back_logo = _.isUndefined(data.is_back_logo) ? 0 : parseInt(data.is_back_logo);
if( _.isUndefined(data.is_logo) || data.is_logo == 1 ) {
%>