조건부 이미지 크기
본문
회원이 아닐경우에 뜨는 이미지와 회원일경우에 뜨는 이미지의 크기를 다르게 설정하고싶은데 이 코드에서 수정해야할 부분이 있을까요?
회원이 아닐경우 뜨는 이미지의 가로 길이가 300인데 회원일경우 이미지가 1000 으로 떴으면 합니다.
지금은 회원이든 아니든 계속 300으로만 뜨고 있어서 답답한 마음에 질문해봅니다...!
// 멤버공개 데이터일 시
$is_viewer = true;
$data_width = 300;
$no_member_class = '';
if(strstr($list_item['wr_option'],"secret") ) {
if( !$list_item['mb_id'] && get_session("ss_secret_{$bo_table}_{$list_item['wr_num']}") || $list_item['mb_id'] && $list_item['mb_id']==$member['mb_id'] || $is_admin )
$is_viewer = true;
else {
$is_viewer = false;
$no_member_class= 'empty secret';
}
} else if ($list_item['wr_protect']!=''){
if( get_session("ss_secret_{$bo_table}_{$list_item['wr_num']}") || $list_item['mb_id'] && $list_item['mb_id']==$member['mb_id'] || $is_admin )
$is_viewer = true;
else {
$is_viewer = false;
$no_member_class= 'empty protect';
}
}else if($list_item['wr_secret'] == '1') {
if($board['bo_read_level'] < $member['mb_level'] && $is_member)
$is_viewer = true;
else {
$is_viewer = false;
$no_member_class = ' empty ';
}
} else {
$is_viewer=true;
$tb_width=1000;
if($board['bo_table_width']>100)
$tb_width=$board['bo_table_width'];
if($board['bo_image_width']>0 && $image_width>$board['bo_image_width'] || $image_width>$tb_width) {
if($list_item['wr_type']!='VIDEO' && $list_item['wr_type']!='TEXT' )
$msg="";
} //@200602
if($board['bo_image_width']>0 && $image_width>$board['bo_image_width'] && $list_item['wr_wide']!='1'){
$data_width=$board['bo_image_width'];
}
else if($image_width<300)
$data_width=300;
else $data_width = $image_width;
}
답변 2
if($member['mb_level']){
$data_width = 1000;
}else{
$data_width = 300;
}
이렇게 해보는건 어떠실까요?
if ($list_item['wr_secret'] == '1') {
if ($board['bo_read_level'] < $member['mb_level'] && $is_member) {
$is_viewer = true;
} else {
$is_viewer = false;
$no_member_class = ' empty ';
}
} else {
$is_viewer = true;
$tb_width = 1000;
if ($board['bo_table_width'] > 100) {
$tb_width = $board['bo_table_width'];
}
if ($board['bo_image_width'] > 0 && $image_width > $board['bo_image_width'] || $image_width > $tb_width) {
if ($list_item['wr_type'] != 'VIDEO' && $list_item['wr_type'] != 'TEXT') {
$msg = "";
}
}
if ($board['bo_image_width'] > 0 && $image_width > $board['bo_image_width'] && $list_item['wr_wide'] != '1') {
$data_width = $board['bo_image_width'];
} else if ($image_width < 300) {
$data_width = 300;
} else {
$data_width = $image_width;
}
if ($is_viewer) {
$data_width = $tb_width;
}
}