Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
2ee2b237
Commit
2ee2b237
authored
May 30, 2018
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show previews
parent
3ad5c06d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
dataRetrieval.js
catalog/static/js/dataRetrieval.js
+4
-5
views.py
catalog/views.py
+4
-5
No files found.
catalog/static/js/dataRetrieval.js
View file @
2ee2b237
...
...
@@ -208,9 +208,8 @@ $(document).ready(function () {
// 'csrfmiddlewaretoken': document.getElementsByName('csrfmiddlewaretoken')[0].value,
'value'
:
data
.
product
.
link_icon
},
dataType
:
'text'
,
success
:
function
(
response
)
{
console
.
log
(
"from img response: "
,
response
);
dataType
:
'json'
,
success
:
function
(
res
)
{
var
product_html
=
'<li id="'
+
data
.
id
+
'" onclick="drawApiResponse(this)" class="hover-me">'
+
'<a href="javascript:void(0)">'
+
'<i class="menu-icon glyphicon glyphicon-bookmark bg-red"></i>'
+
...
...
@@ -221,8 +220,8 @@ $(document).ready(function () {
'</a>'
+
'<div id="'
+
data
.
id
+
'-hover" class="item-info-view">'
+
'<div class="cropped-preview">'
+
'<img src="'
+
data
.
img
+
'">'
+
// '<img src="data:image/jpeg;base64, ' + raw_
img + '">'+
//
'<img src="' + data.img + '">'+
'<img src="data:image/png;base64, '
+
res
.
img
+
'">'
+
'</div>'
+
'<div class="polygon-item-data">'
+
'<div class="city">'
+
data
.
product
.
identifier
+
'</div>'
+
...
...
catalog/views.py
View file @
2ee2b237
...
...
@@ -10,6 +10,7 @@ from django.views.generic.base import View
from
django.template
import
loader
from
urllib
import
urlencode
import
requests
,
json
,
unicodedata
,
sys
import
base64
sys
.
path
.
append
(
'../'
)
from
geosentinel
import
APISentinel
...
...
@@ -38,15 +39,13 @@ def map(request):
#-------------------------------------------------------------------------------
def
requestToImage
(
request
):
# print("REQUEST: ", request.GET)
img_link
=
request
.
GET
[
'value'
]
# img_link = img_link[:img_link.find("/") + 2] + "emmhp:geoemm29@" + img_link[img_link.find("/") + 2:]
#
r = requests.get(img_link, auth=("emmhp", "geoemm29"), stream=True)
# print("RAAAW: ", r.raw
)
r
=
requests
.
get
(
img_link
,
auth
=
(
"emmhp"
,
"geoemm29"
),
stream
=
True
)
img_str
=
base64
.
b64encode
(
r
.
content
)
return
JsonResponse
({
'img'
:
"reqToIMG"
})
# return HttpResponse(r.raw, content_type="image/jpeg")
return
JsonResponse
({
'img'
:
img_str
})
#-------------------------------------------------------------------------------
def
productList
(
request
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment