Uname: Linux webm012.cluster130.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Software: Apache
PHP version: 8.0.30 [ PHP INFO ] PHP os: Linux
Server Ip: 145.239.37.162
Your Ip: 216.73.216.190
User: dreampi (1009562) | Group: users (100)
Safe Mode: OFF
Disable Function:
_dyuweyrj4,_dyuweyrj4r,dl

name : PictureUpload.vue
<template id="picture-upload">
  <div class="am-profile-photo" @click="openMediaModal">
    <i
        class="el-icon-delete" @click="(e) => removeImage(e)"
       v-if="deleteIconVisibility"
    ></i>
    <i :class="{ 'el-icon-plus': entityName === 'gallery', 'el-icon-picture': entityName !== 'gallery' }"></i>
    <span v-if="entityName === 'gallery'">{{ $root.labels.add_image }}</span>
    <img v-if="entityName !== 'gallery'" :src="getPictureSrc" alt="">
  </div>
</template>

<script>
  export default {

    template: '#picture-upload',

    props: {
      deleteIconVisibility: false,
      editedEntity: null,
      entityName: '',
      multiple: false
    },

    data: () => ({
      pictureFullPath: '',
      pictureThumbPath: ''
    }),

    mounted () {

    },

    methods: {
      removeImage (e) {
        e.stopPropagation()

        this.pictureFullPath = ''
        this.pictureThumbPath = ''

        this.$emit('deleteImage')
      },

      openMediaModal () {
        var frame
        var $this = this

        if (frame) {
          frame.open()
          return
        }

        // eslint-disable-next-line no-undef
        frame = wp.media({
          title: 'Select or Upload Profile Picture',
          button: {
            text: 'Select picture'
          },
          multiple: this.multiple,
          library: {
            type: 'image'
          }
        })

        frame.on('select', function () {
          let selection = frame.state().get('selection')
          let attachment = null

          selection.forEach(function (item) {
            attachment = item.toJSON()

            $this.pictureFullPath = attachment.url
            $this.pictureThumbPath = attachment.sizes.thumbnail ? attachment.sizes.thumbnail.url : attachment.url
            $this.$emit('pictureSelected', $this.pictureFullPath, $this.pictureThumbPath)
          })
        })

        frame.open()
      }

    },

    computed: {

      getPictureSrc: function () {
        if (this.editedEntity !== null && !this.pictureThumbPath && !!this.editedEntity.pictureThumbPath) {
          return this.editedEntity.pictureThumbPath
        }

        return this.pictureThumbPath && this.entityName !== 'gallery'
          ? this.pictureThumbPath : this.$root.getUrl + 'public/img/default-' + this.entityName + '.svg'
      }

    }

  }
</script>
© 2026 GrazzMean-Shell