screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Beautiful Image Transition</title> <link href="https://cdn.jsdelivr.net/npm/@mdi/font/css/materialdesignicons.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet"> </head> <body> <div id="app"> <v-app> <v-main> <v-container> <h3 class="text-center">Vuetify Image Upload with Preview</h3> <v-row justify="center"> <v-col cols="12" sm="6" md="4"> <v-file-input v-model="selectedFile" label="Choose Image" @change="handleFileUpload"></v-file-input> </v-col> <v-col cols="12" sm="6" md="4"> <!-- Display the preview image next to the input file element --> <v-img v-if="previewImage" :src="previewImage" alt="Preview" class="preview-image" @click="showModal"></v-img> </v-col> </v-row> </v-container> <v-dialog v-model="isModalVisible" max-width="800"> <v-card> <v-card-actions><v-spacer></v-spacer> <v-btn icon @click="hideModal" class="modal-close"> <v-icon>mdi-close</v-icon> </v-btn> </v-card-actions> <v-img :src="previewImage" alt="Preview"></v-img> </v-card> </v-dialog> </v-main> </v-app> </div> <script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script> <script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script> <script> new Vue({ el: '#app', vuetify: new Vuetify(), data() { return { selectedFile: null, previewImage: "https://www.sarkarinaukriexams.com/images/editor/1684236637tree-g37135fa70_640.jpg", isModalVisible: false, }; }, methods: { handleFileUpload() { const file = this.selectedFile; if (file) { const reader = new FileReader(); reader.onload = () => { this.previewImage = reader.result; }; reader.readAsDataURL(file); } }, showModal() { this.isModalVisible = true; }, hideModal() { this.isModalVisible = false; }, }, }); </script> <style scoped> /* Add styles for the preview image */ .preview-image { border-radius: 50%; width: 100px; /* Adjust the size as needed */ height: 100px; /* Adjust the size as needed */ } </style> </body> </html>