diff --git a/backend/api.py b/backend/api.py index 5badaca5..9a488a0a 100755 --- a/backend/api.py +++ b/backend/api.py @@ -127,7 +127,7 @@ def returnAllSites(): if main_photo: photo_schema = models.TPhotoSchema() main_photo = photo_schema.dump(main_photo) - site['main_photo'] = utils.getThumbnail(main_photo).get('output_name') + site['main_photo'] = main_photo.get("path_file_photo") #utils.getThumbnail(main_photo).get('output_name') else: site["main_photo"] = "no_photo" @@ -164,9 +164,6 @@ def returnSiteById(id_site): site[0]['themes'] = themes_list site[0]['subthemes'] = subthemes_list - for photo in dump_photos: - photo['sm'] = utils.getThumbnail(photo).get('output_name'), - photos = dump_photos return jsonify(site=site, photos=photos), 200 @@ -175,8 +172,6 @@ def returnSiteById(id_site): def gallery(): get_photos = models.TPhoto.query.order_by('id_site').all() dump_photos = photo_schema.dump(get_photos) - for photo in dump_photos: - photo['sm'] = utils.getThumbnail(photo).get('output_name') return jsonify(dump_photos), 200 diff --git a/docker/README.md b/docker/README.md index 28b0dc86..304b92f0 100644 --- a/docker/README.md +++ b/docker/README.md @@ -44,7 +44,7 @@ Exemple : ``` export const Conf = { apiUrl: '/api/', - staticPicturesUrl: '/static/data/images/', + img_srv: '/static/data/images/', customFiles: '/static/custom/', id_application: 1, ign_Key: 'ign key', diff --git a/docs/installation.md b/docs/installation.md index f5b5edf3..e33e9b1e 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -139,7 +139,7 @@ Désampler et éditer le fichier de configuration > Pour utiliser l'utilisateur \"admin\" créé par défaut, il faut renseigner `id_application : 1` -> Pour `apiUrl` et `staticPicturesUrl`, bien mettre , si utilisation d'une adresse IP +> Pour `apiUrl` et `img_srv`, bien mettre , si utilisation d'une adresse IP **2. Lancer l'installation automatique de l'application :** ``` diff --git a/front-backOffice/src/app/add-site/add-site.component.ts b/front-backOffice/src/app/add-site/add-site.component.ts index cbff1bf6..4649cb97 100644 --- a/front-backOffice/src/app/add-site/add-site.component.ts +++ b/front-backOffice/src/app/add-site/add-site.component.ts @@ -449,12 +449,12 @@ export class AddSiteComponent implements OnInit, OnDestroy { _.forEach(site.photos, (photo) => { this.initPhotos.push({ id_photo: photo.id_photo, - imgUrl: Conf.staticPicturesUrl + photo.sm, + imgUrl: Conf.img_srv + 'crop?file=' + photo.path_file_photo + '&width=120&height=120&type=jpeg', name: photo.path_file_photo, }); this.photos.push({ id_photo: photo.id_photo, - imgUrl: Conf.staticPicturesUrl + photo.sm, + imgUrl: Conf.img_srv + 'crop?file=' + photo.path_file_photo + '&width=120&height=120&type=jpeg', name: photo.path_file_photo, }); }); @@ -648,7 +648,7 @@ export class AddSiteComponent implements OnInit, OnDestroy { _.remove(this.new_photos, (item) => { return item === photo; }); - photo.imgUrl = photo.imgUrl.replace(Conf.staticPicturesUrl, ''); + photo.imgUrl = photo.imgUrl.replace(Conf.img_srv, ''); this.deleted_photos.push(photo); } diff --git a/front-backOffice/src/app/config.ts.tpl b/front-backOffice/src/app/config.ts.tpl index 337b8a2d..66cd6220 100644 --- a/front-backOffice/src/app/config.ts.tpl +++ b/front-backOffice/src/app/config.ts.tpl @@ -1,6 +1,6 @@ export const Conf = { apiUrl: '/api/', - staticPicturesUrl: '/pictures/', + img_srv: '/pictures/', customFiles: '/static/custom/', id_application: id_app, ign_Key : 'ign key', diff --git a/front-backOffice/src/app/gallery/gallery.component.ts b/front-backOffice/src/app/gallery/gallery.component.ts index 43b386a3..fc6db6b4 100644 --- a/front-backOffice/src/app/gallery/gallery.component.ts +++ b/front-backOffice/src/app/gallery/gallery.component.ts @@ -55,7 +55,7 @@ export class GalleryComponent implements OnInit { if (photo.id_photo === data.site[0].main_photo) { photo.main_photo = true; } - photo.sm = Conf.staticPicturesUrl + photo.sm; + photo.sm = Conf.img_srv + 'crop?file=' + photo.path_file_photo + '&width=150&height=150&type=jpeg'; photo.cssClass = 'gallery'; }); diff --git a/front-backOffice/src/app/manage-sites/manage-sites.component.html b/front-backOffice/src/app/manage-sites/manage-sites.component.html index a05fb3f5..3f085e8f 100644 --- a/front-backOffice/src/app/manage-sites/manage-sites.component.html +++ b/front-backOffice/src/app/manage-sites/manage-sites.component.html @@ -12,7 +12,7 @@ [reorderable]="reorderable" [selectionType]="'single'" (activate)="onCenterChange($event)" (select)='onSelect($event)'> - + diff --git a/front-backOffice/src/app/manage-sites/manage-sites.component.ts b/front-backOffice/src/app/manage-sites/manage-sites.component.ts index cc8078aa..b9fb1be7 100644 --- a/front-backOffice/src/app/manage-sites/manage-sites.component.ts +++ b/front-backOffice/src/app/manage-sites/manage-sites.component.ts @@ -72,7 +72,6 @@ export class ManageSitesComponent implements OnInit, OnDestroy { this.siteService.getAllSites().subscribe( (sites) => { _.forEach(sites, (site) => { - site.main_photo = Conf.staticPicturesUrl + site.main_photo; const newMarker = marker(site.geom, { icon: L.icon({ iconSize: [ 25, 41 ], @@ -85,12 +84,13 @@ export class ManageSitesComponent implements OnInit, OnDestroy { '
' + site.name_site + '
' + - '
'; const customOptions = { className: 'custom-popup' }; + site.main_photo = Conf.img_srv + 'crop?file=' + site.main_photo + '&width=50&height=50&type=jpeg' site.marker = newMarker.bindPopup(customPopup, customOptions); newMarker .bindPopup(customPopup, customOptions) diff --git a/front-backOffice/src/app/observatories/observatories.component.html b/front-backOffice/src/app/observatories/observatories.component.html index a8dcc3f4..0171e9bf 100644 --- a/front-backOffice/src/app/observatories/observatories.component.html +++ b/front-backOffice/src/app/observatories/observatories.component.html @@ -23,13 +23,11 @@ (activate)="onCenterChange($event)" (select)="onSelect($event)" > - + diff --git a/front-backOffice/src/app/observatories/observatories.component.ts b/front-backOffice/src/app/observatories/observatories.component.ts index 7c184e49..fd77d08f 100644 --- a/front-backOffice/src/app/observatories/observatories.component.ts +++ b/front-backOffice/src/app/observatories/observatories.component.ts @@ -92,7 +92,7 @@ export class ObservatoriesComponent implements OnInit, OnDestroy { this.observatoriesSrv.getAll().subscribe( (items) => { _.forEach(items, (observatory) => { - observatory.photo = Conf.staticPicturesUrl + observatory.photo + observatory.logo = Conf.img_srv + 'crop?file=' + observatory.logo + '&width=50&height=50' /* const newMarker = Marker(observatory.geom, { icon: L.icon({ iconSize: [25, 41], diff --git a/front-backOffice/src/app/observatory/observatory.component.html b/front-backOffice/src/app/observatory/observatory.component.html index 1534ea2c..e07fe13d 100644 --- a/front-backOffice/src/app/observatory/observatory.component.html +++ b/front-backOffice/src/app/observatory/observatory.component.html @@ -80,7 +80,7 @@
@@ -120,7 +120,7 @@
diff --git a/front-backOffice/src/app/observatory/observatory.component.ts b/front-backOffice/src/app/observatory/observatory.component.ts index b4122808..86092a81 100644 --- a/front-backOffice/src/app/observatory/observatory.component.ts +++ b/front-backOffice/src/app/observatory/observatory.component.ts @@ -54,7 +54,7 @@ export class ObservatoryComponent implements OnInit { zoom: 10, center: latLng(Conf.map_lat_center, Conf.map_lan_center), }; - photoBaseUrl = Conf.staticPicturesUrl; + photoBaseUrl = Conf.img_srv; drawOptions = { position: 'topleft', draw: { @@ -448,7 +448,7 @@ export class ObservatoryComponent implements OnInit { _.remove(this.new_photos, (item) => { return item === photo; }); - photo.imgUrl = photo.imgUrl.replace(Conf.staticPicturesUrl, ''); + photo.imgUrl = photo.imgUrl.replace(Conf.img_srv, ''); this.deleted_photos.push(photo); }