19 lines
639 B
JavaScript
19 lines
639 B
JavaScript
import {computed} from "vue";
|
|
import {croppedArea} from "src/composables/photos/editor/crop";
|
|
|
|
export const getPreviewUrl = (photoId, adjustments) => {
|
|
const url = new URL(`${process.env.API_URL}/photo/editor-preview/${photoId}`);
|
|
url.search = new URLSearchParams(adjustments).toString();
|
|
return url.toString();
|
|
};
|
|
|
|
export const croppedAreaForPreview = computed(() => {
|
|
if (!croppedArea.value) return {};
|
|
return {
|
|
crop_left: croppedArea.value.left || 0,
|
|
crop_top: croppedArea.value.top || 0,
|
|
crop_width: croppedArea.value.width || 1,
|
|
crop_height: croppedArea.value.height || 1
|
|
}
|
|
});
|