Added links
This commit is contained in:
parent
2c75feddfe
commit
43c26ed063
2 changed files with 20 additions and 3 deletions
|
|
@ -13,13 +13,13 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.apache.commons.fileupload.util.Streams;
|
||||
|
||||
import zall.Zallery;
|
||||
import zall.ZalleryServlet;
|
||||
import zall.bean.Image;
|
||||
import zall.bean.Media;
|
||||
import zall.bean.Video;
|
||||
import zall.manager.ResourceManager;
|
||||
import zutil.db.DBConnection;
|
||||
import zutil.io.file.FileUtil;
|
||||
|
||||
import static zall.page.ContentServlet.URI_IMAGE;
|
||||
import static zall.page.ContentServlet.URI_VIDEO;
|
||||
|
|
@ -76,4 +76,19 @@ public class ContentServlet extends ZalleryServlet {
|
|||
response.setStatus(404);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a URL for a specific media file where its data can be retrieved.
|
||||
*/
|
||||
public static String getMediaUrl(Media media, Media.Size size) {
|
||||
return getMediaUrl(media, size, false);
|
||||
}
|
||||
/**
|
||||
* @return a URL for a specific media file where its data can be retrieved.
|
||||
*/
|
||||
public static String getMediaUrl(Media media, Media.Size size, boolean download) {
|
||||
return Zallery.WEBSITE_URL + "/" + media.getType().toString().toLowerCase() +
|
||||
"?id=" + media.getId() + "&size=" + size.toString().toLowerCase() +
|
||||
(download ? "&download" : "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue