Commit a0576b60 by Amparo Oliver

Ruta Imagen

parent fb0a519a
...@@ -8,6 +8,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter ...@@ -8,6 +8,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
public class ResourceConfig extends WebMvcConfigurerAdapter { public class ResourceConfig extends WebMvcConfigurerAdapter {
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/images/**").addResourceLocations("file:images/"); registry.addResourceHandler("/uploadsBirthday/**").addResourceLocations("file:./uploadsBirthday/");
} }
} }
...@@ -96,7 +96,7 @@ public class BirthdayController { ...@@ -96,7 +96,7 @@ public class BirthdayController {
Path rutaCompleta = Paths.get(rutaAbsoluta); Path rutaCompleta = Paths.get(rutaAbsoluta);
Files.write(rutaCompleta, bytesImg); Files.write(rutaCompleta, bytesImg);
// Si todo sale bien, guarda la foto en la base de datos // Si todo sale bien, guarda la foto en la base de datos
birthday.setFoto("http://192.168.16.90:8888/uploadsBirthday/" + DigestUtils.md5Hex(originalFilename) + "." + fileExtension); birthday.setFoto("uploadsBirthday/" + DigestUtils.md5Hex(originalFilename) + "." + fileExtension);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment