Skip to content

Commit

Permalink
[UPD] add image proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Viglino committed Dec 14, 2023
1 parent ac577c4 commit 00aaead
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 84 deletions.
9 changes: 1 addition & 8 deletions examples/control/map.control.overlay.menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
<meta name="description" content="styled popup for OL3" />
<meta name="keywords" content="ol3, manu, control, overlay, jQuery" />

<!-- Prevent image error on load with https -->
<script>
if (location.protocol == 'https:' && !/^localhost/.test(location.host)) {
location.href = window.location.href.replace(/^https:/,'http:');
}
</script>

<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<!-- FontAwesome -->
Expand Down Expand Up @@ -182,7 +175,7 @@ <h1>Menu</h1>
// On selected => show/hide popup
select.getFeatures().on('add', function(e){
var feature = e.element;
var img = $("<img>").attr("src", feature.get("img"));
var img = $("<img>").attr("src", '//wsrv.nl/?url=' + feature.get("img"));
var info = $("<div>").append( $("<p>").text(feature.get("text")));
var content = $("<div>")
.append( img )
Expand Down
5 changes: 0 additions & 5 deletions examples/layer/map.wmscapabilities.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ <h1>ol-ext: WMS Capabilities control</h1>
</div>

<script type="text/javascript">
// http services load on http
if (location.protocol === 'https:' && !/^localhost/.test(location.host)) {
location.href = window.location.href.replace(/^https:/,'http:');
}

// Define proj4 2154
proj4.defs("EPSG:2154","+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
if (ol.proj.proj4 && ol.proj.proj4.register) ol.proj.proj4.register(proj4);
Expand Down
9 changes: 1 addition & 8 deletions examples/popup/map.control.overlay.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
<meta name="description" content="styled popup for OL3" />
<meta name="keywords" content="ol3, menu, control, overlay, jQuery" />

<!-- Prevent image error on load with https -->
<script>
if (location.protocol == 'https:' && !/^localhost/.test(location.host)) {
location.href = window.location.href.replace(/^https:/,'http:');
}
</script>

<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

Expand Down Expand Up @@ -154,7 +147,7 @@ <h2>Options:</h2>
// On selected => show/hide popup
select.getFeatures().on('add', function(e) {
var feature = e.element;
popup.showImage(feature.get("img").replace("_v.jpg","_p.jpg"), {
popup.showImage('//wsrv.nl/?url=' + feature.get("img").replace("_v.jpg","_p.jpg"), {
coordinate: (/frompoint/.test($("#anim").val()) ? feature.getGeometry().getCoordinates() : null),
title: feature.get("text") +'<br/>'
+feature.get("commune")+" ("+feature.get("region")+" - "+feature.get("date").replace(".","/")+")<br/>"
Expand Down
9 changes: 1 addition & 8 deletions examples/popup/map.fixedpopup.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
<meta name="description" content="Display fixed popup on the map" />
<meta name="keywords" content="openlayers, ol, popup, overlay, fix" />

<!-- Prevent image error on load with https -->
<script>
if (location.protocol == 'https:' && !/^localhost/.test(location.host)) {
location.href = window.location.href.replace(/^https:/,'http:');
}
</script>

<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

Expand Down Expand Up @@ -205,7 +198,7 @@ <h2>Options:</h2>
select.getFeatures().on(['add'], function(e) {
var feature = e.element;
var content = "";
content += "<img src='"+feature.get("img")+"'/>";
content += "<img src='" + '//wsrv.nl/?url=' + feature.get("img") + "'/>";
content += feature.get("text");
content += '<br/><i>powered by <a href="https://github.com/Viglino/ol-ext" target="ol">ol-ext</a></i>';
if (select.getFeatures().getLength()>1) {
Expand Down
9 changes: 1 addition & 8 deletions examples/popup/map.popup.anim.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
<meta name="description" content="animated popup for OL3" />
<meta name="keywords" content="ol3, popup, overlay, jQuery, animation" />

<!-- Prevent image error on load with https -->
<script>
if (location.protocol == 'https:' && !/^localhost/.test(location.host)) {
location.href = window.location.href.replace(/^https:/,'http:');
}
</script>

<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

Expand Down Expand Up @@ -156,7 +149,7 @@ <h2>Options:</h2>
select.getFeatures().on(['add'], function(e) {
var feature = e.element;
var content = "";
content += "<img src='"+feature.get("img")+"'/>";
content += "<img src='" + '//wsrv.nl/?url=' + feature.get("img") + "'/>";
content += feature.get("text");
popup.show(feature.getGeometry().getCoordinates(), content);
})
Expand Down
9 changes: 1 addition & 8 deletions examples/popup/map.popup.bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
<meta name="description" content="Styled popup for Openlayers" />
<meta name="keywords" content="ol, openlayers, popup, overlay, style" />

<!-- Prevent image error on load with https -->
<script>
if (location.protocol == 'https:' && !/^localhost/.test(location.host)) {
location.href = window.location.href.replace(/^https:/,'http:');
}
</script>

<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

Expand Down Expand Up @@ -215,7 +208,7 @@ <h2>Options:</h2>
select.getFeatures().on(['add'], function(e) {
var feature = e.element;
var content = "";
content += "<img src='"+feature.get("img")+"'/>";
content += "<img src='" + '//wsrv.nl/?url=' + feature.get("img") + "'/>";
content += '<a href="https://www.culture.gouv.fr/" target="new">&copy; Ministère de la Culture</a><br/>';
content += feature.get("text");
popup.show(feature.getGeometry().getFirstCoordinate(), content);
Expand Down
9 changes: 1 addition & 8 deletions examples/popup/map.popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
<meta name="description" content="Styled popup for Openlayers" />
<meta name="keywords" content="ol, openlayers, popup, overlay, style" />

<!-- Prevent image error on load with https -->
<script>
if (location.protocol == 'https:' && !/^localhost/.test(location.host)) {
location.href = window.location.href.replace(/^https:/,'http:');
}
</script>

<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

Expand Down Expand Up @@ -222,7 +215,7 @@ <h2>Options:</h2>
select.getFeatures().on(['add'], function(e) {
var feature = e.element;
var content = "";
content += "<img src='"+feature.get("img")+"'/>";
content += "<img src='" + '//wsrv.nl/?url=' + feature.get("img") + "'/>";
content += feature.get("text");
popup.show(feature.getGeometry().getFirstCoordinate(), content);
});
Expand Down
9 changes: 1 addition & 8 deletions examples/storymap/map.control.imageline.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
<meta name="description" content="A control to show image on a map." />
<meta name="keywords" content="ol, image, control, line" />

<!-- Prevent image error on load with https -->
<script>
if (location.protocol == 'https:' && !/^localhost/.test(location.host)) {
location.href = window.location.href.replace(/^https:/,'http:');
}
</script>

<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

Expand Down Expand Up @@ -147,7 +140,7 @@ <h1>ol-ext: Image line control</h1>
if (!style) {
style = cache[id] = new ol.style.Style({
image: new ol.style.Photo({
src: f.get('img'),
src: '//wsrv.nl/?url=' + f.get('img'),
radius: select ? 20:15,
shadow: true,
stroke: new ol.style.Stroke({
Expand Down
9 changes: 1 addition & 8 deletions examples/storymap/map.control.timeinterval.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
<meta name="description" content="A control to add timeline on a map." />
<meta name="keywords" content="ol, timeline, control, date" />

<!-- Prevent image error on load with https -->
<script>
if (location.protocol == 'https:' && !/^localhost/.test(location.host)) {
location.href = window.location.href.replace(/^https:/,'http:');
}
</script>

<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

Expand Down Expand Up @@ -123,7 +116,7 @@ <h1>ol-ext: Timeline control</h1>
var style = cache[f.get('img')+'-'+select];
if (!style) {
var img = new ol.style.Photo({
src: f.get('img'),
src: '//wsrv.nl/?url=' + f.get('img'),
radius: select ? 20:15,
shadow: true,
stroke: new ol.style.Stroke({
Expand Down
9 changes: 1 addition & 8 deletions examples/storymap/map.control.timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
<meta name="description" content="A control to add timeline on a map." />
<meta name="keywords" content="ol, timeline, control, date" />

<!-- Prevent image error on load with https -->
<script>
if (location.protocol == 'https:' && !/^localhost/.test(location.host)) {
location.href = window.location.href.replace(/^https:/,'http:');
}
</script>

<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

Expand Down Expand Up @@ -114,7 +107,7 @@ <h2>Options:</h2>
var style = cache[f.get('img')+'-'+select];
if (!style) {
var img = new ol.style.Photo({
src: f.get('img'),
src: '//wsrv.nl/?url=' + f.get('img'),
radius: select ? 20:15,
shadow: true,
stroke: new ol.style.Stroke({
Expand Down
7 changes: 0 additions & 7 deletions examples/storymap/map.control.timemap.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
<meta name="description" content="A control to add timeline on a map." />
<meta name="keywords" content="ol, timeline, control, date" />

<!-- Prevent image error on load with https -->
<script>
if (location.protocol == 'https:' && !/^localhost/.test(location.host)) {
location.href = window.location.href.replace(/^https:/,'http:');
}
</script>

<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

Expand Down

0 comments on commit 00aaead

Please sign in to comment.