瀏覽代碼

사은품 이미지 관려 경로 수정

eskim 5 年之前
父節點
當前提交
e1e90bb1b9

+ 2 - 1
src/main/java/com/style24/admin/biz/web/TsaGoodsController.java

@@ -2616,7 +2616,7 @@ public class TsaGoodsController extends TsaBaseController {
 			String sysImgNm = freeGoods.getProductNo() + "_" + GagaDateUtil.getTodayDateTime() + "." + org.springframework.util.StringUtils.getFilenameExtension(freeGoods.getNewSysImgNm());
 
 			String imgUploadPath = env.getProperty("upload.default.target.path");
-			imgUploadPath = GagaFileUtil.getConcatenationPath(imgUploadPath, "display", "freegoods");
+			imgUploadPath = GagaFileUtil.getConcatenationPath(imgUploadPath, "contents", "freegoods");
 
 			//기존이미지 삭제
 			try {
@@ -2634,6 +2634,7 @@ public class TsaGoodsController extends TsaBaseController {
 			// Rename a file
 			file.renameTo(uniqueFile);
 
+			sysImgNm = "/contents/freegoods/" + sysImgNm;
 			freeGoods.setSysImgNm(sysImgNm);
 
 		}

+ 6 - 4
src/main/webapp/WEB-INF/views/goods/GoodsFreeGoodsForm.html

@@ -130,7 +130,7 @@
 								<input type="hidden" name="sysImgNm" id="sysImgNm"/>
 								<input type="hidden" name="newSysImgNm" id="newSysImgNm"/>
 							</div>
-							<input type="hidden" name="uploadDefaultUrl" id="uploadDefaultUrl" th:value="${@environment.getProperty('upload.default.view') + '/display/freegoods/'}"/>
+							<input type="hidden" name="uploadDefaultUrl" id="uploadDefaultUrl" th:value="${@environment.getProperty('upload.default.view')}"/>
 							<div id="imgView" class="off">
 								<img id="bannerPreViewUrl" src="" style="height:100px"/>
 							</div>
@@ -154,7 +154,7 @@
 		{headerName: 'No', width: 60, cellClass: 'text-center', valueGetter: function(params) { return params.node.rowIndex + 1 }},
 		{headerName: "이미지", field: "sysImgNm", width: 100, height: 60, cellClass: 'text-center'
 			,cellRenderer: function(params) {
-				return '<img width="60" src="'+ _imgUrl+ "/display/freegoods/" + params.value + '" alt="" onerror="this.src=\'/image/no.gif\';"/>';
+				return '<img width="60" src="'+ _imgUrl+  params.value + '" alt="" onerror="this.src=\'/image/no.gif\';"/>';
 			}
 		},
 		{headerName: "브랜드", field: "brandEnm", width: 130, cellClass: 'text-center'},
@@ -208,6 +208,8 @@
 				$("#imgView").removeClass("off").addClass("on");
 			}else {
 				$("#sysImgNm").val('');
+				$("#bannerPreViewUrl").attr('src', '');
+				$("#imgView").removeClass("on").addClass("off");
 			}
 			$('#detailForm input[name=file]').closest('div').find('label').text('파일선택');
 		}
@@ -294,12 +296,12 @@
 		var file = this.files[0];
 
 		// 파일 업로드
-		gagajf.ajaxFileUpload('/common/file/upload?subDir=/display/freegoods'
+		gagajf.ajaxFileUpload('/common/file/upload?subDir=/contents/freegoods'
 				, file
 				, function(result) {
 					// 업로드한 파일명 설정
 					$('#detailForm input[name=newSysImgNm]').val(result.newFileName);
-					$("#bannerPreViewUrl").attr('src', $("#uploadDefaultUrl").val()+result.newFileName);
+					$("#bannerPreViewUrl").attr('src', $("#uploadDefaultUrl").val()+"/contents/freegoods/"+result.newFileName);
 					$("#imgView").removeClass("off").addClass("on");
 				}
 		);