mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-29 07:56:37 +08:00
优化
This commit is contained in:
+14
-2
@@ -4,11 +4,15 @@ import cloud.tianai.captcha.common.constant.CaptchaTypeConstant;
|
||||
import cloud.tianai.captcha.resource.FontCache;
|
||||
import cloud.tianai.captcha.resource.ResourceStore;
|
||||
import cloud.tianai.captcha.resource.common.model.dto.Resource;
|
||||
import cloud.tianai.captcha.resource.common.model.dto.ResourceMap;
|
||||
import cloud.tianai.captcha.resource.impl.provider.ClassPathResourceProvider;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import static cloud.tianai.captcha.common.constant.CommonConstant.DEFAULT_SLIDER_IMAGE_TEMPLATE_PATH;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CaptchaResourceConfiguration {
|
||||
@@ -22,16 +26,24 @@ public class CaptchaResourceConfiguration {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// 添加自定义背景图片
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
ResourceMap template = new ResourceMap("default", 4);
|
||||
template.put("active.png", new Resource(ClassPathResourceProvider.NAME, "slide/" + i + "/1.png"));
|
||||
template.put("fixed.png", new Resource(ClassPathResourceProvider.NAME, "slide/" + i + "/2.png"));
|
||||
resourceStore.addTemplate(CaptchaTypeConstant.SLIDER, template);
|
||||
}
|
||||
|
||||
|
||||
// 添加自定义背景图片
|
||||
for (String option : OPTIONS) {
|
||||
for (int i = 1; i <= 26; i++) {
|
||||
resourceStore.addResource(option, new Resource("classpath", "bgimages/"+i + ".jpg", "default"));
|
||||
resourceStore.addResource(option, new Resource("classpath", "bgimages/" + i + ".jpg", "default"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//添加自定义字体
|
||||
resourceStore.addResource(FontCache.FONT_TYPE,new Resource("classpath", "fonts/SIMSUN.TTC", "default"));
|
||||
resourceStore.addResource(FontCache.FONT_TYPE, new Resource("classpath", "fonts/SIMSUN.TTC", "default"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user