Inhalte aufrufen

Profilbild

WebApi Upload Picture check first for difference


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
8 Antworten zu diesem Thema

#1 TripleNico

TripleNico

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 124 Beiträge

Geschrieben: 30 April 2020 - 16:56

What would be the best way to check if a image is different from the one in SmartStore before uploading a ProductImage?



#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3799 Beiträge

Geschrieben: 30 April 2020 - 17:44

This cannot be detected via the API. So this is only possible on the client\consumer side.


Marcus Gesing

Smartstore AG


#3 TripleNico

TripleNico

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 124 Beiträge

Geschrieben: 01 May 2020 - 08:10

I was affraid you would say that. Because now we upload every x time all the product images. It would be great to have a mechanisme to check upfront if the picture is differtent. Like a field that contains the original file date or the hash of a file.
 
However in the documentation you mention the values "CustomValue1" and "CustomValue2" where are these values stored?



#4 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3799 Beiträge

Geschrieben: 01 May 2020 - 11:22

These are custom values for your own purpose, e.g. for an easier mapping. The API does not process them and just returns them in the ContentDisposition field of the response.


Marcus Gesing

Smartstore AG


#5 TripleNico

TripleNico

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 124 Beiträge

Geschrieben: 01 May 2020 - 12:38

Alright, so as you told before there is currently no way to check if a picture is different before uploading?

 

If not could you please add it to the API roadmap to include two fields, one is PictureCreation date which is the original creation date and the other is PicatureHas which is a MD5 or Sha1 hash of the file. In my opniniun this is the right way to check if a picture is different. If you have any other suggestions please let me know.



#6 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3799 Beiträge

Geschrieben: 01 May 2020 - 13:40

You can use MediaFile.Size (file aka picture size in bytes) of SmartStore.NET version 4.0 to sync but it's a bit inaccurate if different files have the same size. Also new to version 4 is MediaFile.CreatedOnUtc. (Picture table has been renamed in MediaFile due to Media Manager. API Endpoints are the same.)

Marcus Gesing

Smartstore AG


#7 TripleNico

TripleNico

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 124 Beiträge

Geschrieben: 01 May 2020 - 13:44

The MediaFile.CreatedOnUtc would sound like a suitable property however which value is stored in, the original creation date of the file itself OR the moment the file is uploaded?



#8 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3799 Beiträge

Geschrieben: 04 May 2020 - 10:03

The time in UTC when the MediaFile entity was created and stored. A MediaFile does not necessarily represent a file on disk.


Marcus Gesing

Smartstore AG


#9 TripleNico

TripleNico

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 124 Beiträge

Geschrieben: 04 May 2020 - 15:19

Thanks for clearifyng that. I now created my own little database that stores the upload information so i can compare it before uploaded.