pimcore / studio-ui-bundle

Studio UI bundle
Other
13 stars 2 forks source link

Focalpoint Selection #79

Closed fashxp closed 2 weeks ago

fashxp commented 6 months ago

image

markus-moser commented 3 months ago

API requirements:

We need the possiblity to get the focal point out of a asset. It is stored in the custom settings of the asset:

Image

Also when pressing the "Save & Publish" button we need to update the focal point data.

=> Therefore I would suggest to add the relevant focal point attributes to the regular "/asset/{id}" and corresponding asset update call.

mattamon commented 3 months ago

Getting the data was done by https://github.com/pimcore/studio-backend-bundle/pull/52

Response does look like this:

{
  "fixedCustomSettings": {
    "embeddedMetaData": {
      "FileSize": "161 kB",
      "FileModifyDate": "2019:08:23 15:04:09+02:00",
      "FileAccessDate": "2019:08:23 15:04:09+02:00",
      "FileInodeChangeDate": "2019:08:23 15:04:09+02:00",
      "FilePermissions": "rwxrwxr-x",
      "FileType": "JPEG",
      "FileTypeExtension": "jpg",
      "MIMEType": "image/jpeg",
      "JFIFVersion": 1.01,
      "ResolutionUnit": "None",
      "XResolution": 1,
      "YResolution": 1,
      "ImageWidth": 1400,
      "ImageHeight": 838,
      "EncodingProcess": "Progressive DCT, Huffman coding",
      "BitsPerSample": 8,
      "ColorComponents": 3,
      "YCbCrSubSampling": "YCbCr4:2:0 (2 2)",
      "ImageSize": "1400x838",
      "Megapixels": 1.2
    },
    "embeddedMetaDataExtracted": true
  },
  "dynamicCustomSettings": {
    "disableFocalPointDetection": true,
    "checksum": "a239bd1abb9151ed50166acf5273e012",
    "imageDimensionsCalculated": true,
    "imageWidth": 1400,
    "imageHeight": 838,
    "focalPointX": 50,
    "focalPointY": 50
  },
  "additionalAttributes": []
}
mattamon commented 3 months ago

Saving is done here: https://github.com/pimcore/studio-backend-bundle/pull/81

Route is PUT /studio/api/assets/{id}

Payload can look like the following.

{
  "data": {
    "image": {
      "focalPoint": {
        "x": 50,
        "y": 50
      }
    }
  }
}

If you do not send the "image" the focalPoint will be deleted like it is in the current controller.