Files
lelong/resources/js/components/pengurusangambar/marhun/MarhunImage.vue
T
2023-01-30 19:40:21 +08:00

39 lines
1022 B
Vue

<template>
<div class="col-12">
file_marhun_id: {{ props.gambarId }}
</div>
<div class="col-12">
{{ props.noRujukan }}
</div>
<div v-if="stringGambar == 0" class="text-center text-primary">No Image in Storage. Please cp from the server</div>
<img v-else :src="stringGambarMarhun" alt="gambar-marhun" width="180">
</template>
<script setup>
import { ref, onMounted } from 'vue'
import axios from "axios";
const props = defineProps({
gambarId: Number,
noRujukan: String
})
const stringGambar = ref();
const stringGambarMarhun = ref();
function getPhotoMarhun() {
axios.get("/showPhotoMarhun", {
params: {
filemarhun_id: props.gambarId,
norujukan: props.noRujukan,
},
}).then((response) => {
stringGambar.value = response.data;
stringGambarMarhun.value = "data:image/png;base64, " + stringGambar.value;
}).catch((error) => { console.log(error); });
}
onMounted(() => {
getPhotoMarhun();
});
</script>