[미세먼지팁] 배너이미지 갱신 문제 해결 (자동버전화)
extend/version.extend.php
// 파일수정일을 ver 으로 지정
function get_file_ver($file) {
if (file_exists($file)) $str = filemtime($file);
else return false;
return $str;
}
추가
skin/shop/basic/mainbanner.10.skin.php
echo $banner.'<img src="'.G5_DATA_URL.'/banner/'.$row['bn_id'].'" width="'.$size[0].'" alt="'.$row['bn_alt'].'"'.$bn_border.'>';
를
echo $banner.'<img src="'.G5_DATA_URL.'/banner/'.$row['bn_id'].'?ver='.get_file_ver($bimg).'" width="'.$size[0].'" alt="'.$row['bn_alt'].'"'.$bn_border.'>';
로 수정
#1
<img src="경로" alt="">
라고 있을 때
<img src="경로?ver=<?php echo get_file_ver(이미지PATH); ?>" alt="">
처럼 사용하는 방법입니다.
#2
이미지PATH는 G5_DATA_URL 이 아니라, G5_DATA_PATH 를 써야 합니다.
#3
이미지(파일) 수정일을 해당파일의 버전으로 지정하여 브라우저 캐시를 갱신하는 방법입니다.
상단로고이미지 등 영카트 관리자에서 이미지 업로드하여 사용하는 경우에 모두 응용하여 사용할 수 있습니다.
CSS에도 적용가능합니다.
파일 개별로 적용되고 코드에 한 번 지정해놓으면 파일이 변경될 때마다 자동으로 적용되기 때문에 나름 편리합니다.
처음 지정하는게 좀 번거롭죠. ㅎㅎㅎ
#4
영카트5.2.9.3 기준 수정할 파일목록
G5_DATA_URL 로 검색하여 img 처리된 부분에 적용해주시면 됩니다.
adm/contentform.php
adm/faqmasterform.php
adm/member_form.php
bbs/content.php
bbs/faq.php
bbs/qaview.php
bbs/register_form.php
bbs/view_image.php
lib/common.lib.php
lib/shop.lib.php
lib/thumbnail.lib.php
shop/event.php
shop/largeimage.php
shop/shop.head.php
shop/shop.tail.php
adm/shop_admin/bannerform.php
adm/shop_admin/bannerlist.php
adm/shop_admin/configform.php
adm/shop_admin/couponzoneform.php
adm/shop_admin/itemeventform.php
adm/shop_admin/itemform.php
mobile/shop/largeimage.php
mobile/shop/shop.head.php
mobile/shop/shop.tail.php
skin/shop/basic/boxbanner.skin.php
skin/shop/basic/boxevent.skin.php
skin/shop/basic/largeimage.skin.php
skin/shop/basic/mainbanner.10.skin.php
theme/basic/shop/shop.head.php
theme/basic/shop/shop.tail.php
mobile/skin/shop/basic/largeimage.skin.php
mobile/skin/shop/basic/main.event.skin.php
mobile/skin/shop/basic/mainbanner.10.skin.php
theme/basic/mobile/shop/shop.head.php
theme/basic/mobile/shop/shop.tail.php
theme/basic/skin/shop/basic/boxbanner.skin.php
theme/basic/skin/shop/basic/boxevent.skin.php
theme/basic/skin/shop/basic/largeimage.skin.php
theme/basic/skin/shop/basic/mainbanner.10.skin.php
theme/basic/mobile/skin/shop/basic/largeimage.skin.php
theme/basic/mobile/skin/shop/basic/main.event.skin.php
theme/basic/mobile/skin/shop/basic/mainbanner.10.skin.php
// 파일수정일을 ver 으로 지정
function get_file_ver($file) {
if (file_exists($file)) $str = filemtime($file);
else return false;
return $str;
}
추가
skin/shop/basic/mainbanner.10.skin.php
echo $banner.'<img src="'.G5_DATA_URL.'/banner/'.$row['bn_id'].'" width="'.$size[0].'" alt="'.$row['bn_alt'].'"'.$bn_border.'>';
를
echo $banner.'<img src="'.G5_DATA_URL.'/banner/'.$row['bn_id'].'?ver='.get_file_ver($bimg).'" width="'.$size[0].'" alt="'.$row['bn_alt'].'"'.$bn_border.'>';
로 수정
#1
<img src="경로" alt="">
라고 있을 때
<img src="경로?ver=<?php echo get_file_ver(이미지PATH); ?>" alt="">
처럼 사용하는 방법입니다.
#2
이미지PATH는 G5_DATA_URL 이 아니라, G5_DATA_PATH 를 써야 합니다.
#3
이미지(파일) 수정일을 해당파일의 버전으로 지정하여 브라우저 캐시를 갱신하는 방법입니다.
상단로고이미지 등 영카트 관리자에서 이미지 업로드하여 사용하는 경우에 모두 응용하여 사용할 수 있습니다.
CSS에도 적용가능합니다.
파일 개별로 적용되고 코드에 한 번 지정해놓으면 파일이 변경될 때마다 자동으로 적용되기 때문에 나름 편리합니다.
처음 지정하는게 좀 번거롭죠. ㅎㅎㅎ
#4
영카트5.2.9.3 기준 수정할 파일목록
G5_DATA_URL 로 검색하여 img 처리된 부분에 적용해주시면 됩니다.
adm/contentform.php
adm/faqmasterform.php
adm/member_form.php
bbs/content.php
bbs/faq.php
bbs/qaview.php
bbs/register_form.php
bbs/view_image.php
lib/common.lib.php
lib/shop.lib.php
lib/thumbnail.lib.php
shop/event.php
shop/largeimage.php
shop/shop.head.php
shop/shop.tail.php
adm/shop_admin/bannerform.php
adm/shop_admin/bannerlist.php
adm/shop_admin/configform.php
adm/shop_admin/couponzoneform.php
adm/shop_admin/itemeventform.php
adm/shop_admin/itemform.php
mobile/shop/largeimage.php
mobile/shop/shop.head.php
mobile/shop/shop.tail.php
skin/shop/basic/boxbanner.skin.php
skin/shop/basic/boxevent.skin.php
skin/shop/basic/largeimage.skin.php
skin/shop/basic/mainbanner.10.skin.php
theme/basic/shop/shop.head.php
theme/basic/shop/shop.tail.php
mobile/skin/shop/basic/largeimage.skin.php
mobile/skin/shop/basic/main.event.skin.php
mobile/skin/shop/basic/mainbanner.10.skin.php
theme/basic/mobile/shop/shop.head.php
theme/basic/mobile/shop/shop.tail.php
theme/basic/skin/shop/basic/boxbanner.skin.php
theme/basic/skin/shop/basic/boxevent.skin.php
theme/basic/skin/shop/basic/largeimage.skin.php
theme/basic/skin/shop/basic/mainbanner.10.skin.php
theme/basic/mobile/skin/shop/basic/largeimage.skin.php
theme/basic/mobile/skin/shop/basic/main.event.skin.php
theme/basic/mobile/skin/shop/basic/mainbanner.10.skin.php
댓글 6개
8년 전
get_file_ver() 는 매번 실행 되는건가요?
8년 전
네 그래야지 않을까요? 효과적이긴 한데, 효율적인지는 모르겠습니다. 아시죠? ㅎㅎㅎ
고객들이 배너이미지나 로고 수정하고 안 바뀐다고 자꾸 문의를 해서 미봉책으로 그만... ☞☜
고객들이 배너이미지나 로고 수정하고 안 바뀐다고 자꾸 문의를 해서 미봉책으로 그만... ☞☜
8년 전
좀 더 우아한 방법이 없을까 생각하다 검색해봤는데 이런 글이 있네요.
http://code.i-harness.com/ko/q/1d064
http://code.i-harness.com/ko/q/1d064
8년 전
미세먼지는 싫지만... 꿀팁이네요 ㅎ
8년 전
add_stylesheet 로 불러오는 css, js 에 적용은 다음 작업을 추가하셔야 합니다.
common.lib.php
$link[1] = preg_replace('#\.css([\'\"]?>)$#i', '.css?ver='.G5_CSS_VER.'$1', $link[1]);
를
$link[1] = preg_replace('#\.css([\'\"]?>)$#i', '.css$1', $link[1]);
로 수정한 후
add_stylesheet 에 get_file_ver 추가
common.lib.php
$link[1] = preg_replace('#\.css([\'\"]?>)$#i', '.css?ver='.G5_CSS_VER.'$1', $link[1]);
를
$link[1] = preg_replace('#\.css([\'\"]?>)$#i', '.css$1', $link[1]);
로 수정한 후
add_stylesheet 에 get_file_ver 추가
1년 전
감사합니다!! 배너관리가 바로 갱신이 안되서 스트레스받았는데 잘해결했어요!
게시판 목록
영카트5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 101 | 10년 전 | 5225 | ||
| 100 | 10년 전 | 5109 | ||
| 99 | 10년 전 | 5396 | ||
| 98 | 10년 전 | 6735 | ||
| 97 |
|
10년 전 | 5434 | |
| 96 | 10년 전 | 3236 | ||
| 95 |
맥콜맛치킨
|
10년 전 | 2901 | |
| 94 | 10년 전 | 6720 | ||
| 93 | 10년 전 | 7943 | ||
| 92 |
RedDJ
|
10년 전 | 6287 | |
| 91 | 10년 전 | 4780 | ||
| 90 | 10년 전 | 6766 | ||
| 89 | 10년 전 | 9941 | ||
| 88 |
|
10년 전 | 5874 | |
| 87 | 10년 전 | 5462 | ||
| 86 |
RedDJ
|
10년 전 | 4456 | |
| 85 | 10년 전 | 5455 | ||
| 84 |
꼬리가보여
|
10년 전 | 7677 | |
| 83 | 10년 전 | 5153 | ||
| 82 | 10년 전 | 6385 | ||
| 81 | 10년 전 | 5686 | ||
| 80 | 10년 전 | 9739 | ||
| 79 |
|
10년 전 | 6590 | |
| 78 | 10년 전 | 15026 | ||
| 77 | 10년 전 | 5693 | ||
| 76 | 10년 전 | 5612 | ||
| 75 | 10년 전 | 8474 | ||
| 74 | 10년 전 | 11520 | ||
| 73 | 10년 전 | 5185 | ||
| 72 | 10년 전 | 11555 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기