Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/cartforge.co/vendor/magento/module-page-builder/view/adminhtml/web/js/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/vendor/magento/module-page-builder/view/adminhtml/web/js/utils/image.js
/*eslint-disable */
/* jscs:disable */
define(["Magento_PageBuilder/js/config", "Magento_PageBuilder/js/utils/directives", "Magento_PageBuilder/js/utils/url"], function (_config, _directives, _url) {
  /**
   * Copyright © Magento, Inc. All rights reserved.
   * See COPYING.txt for license details.
   */

  /**
   * Decode image background URL to object
   *
   * @param value
   * @returns {Object}
   * @api
   */
  function decodeUrl(value) {
    var result = "";
    value = decodeURIComponent(value.replace(window.location.href, ""));
    var regexp = /{{.*\s*url="?(.*\.([a-z|A-Z]*))"?\s*}}/;

    if (regexp.test(value)) {
      var _regexp$exec = regexp.exec(value),
          url = _regexp$exec[1],
          type = _regexp$exec[2];

      var image = {
        name: url.split("/").pop(),
        size: 0,
        type: "image/" + type,
        url: _config.getConfig("media_url") + url
      };
      result = [image];
    }

    return result;
  }
  /**
   * Convert a URL to an image directive
   *
   * @param {string} imageUrl
   * @returns {string}
   */


  function urlToDirective(imageUrl) {
    var mediaUrl = (0, _url.convertUrlToPathIfOtherUrlIsOnlyAPath)(_config.getConfig("media_url"), imageUrl);
    var mediaPath = imageUrl.split(mediaUrl);
    return "{{media url=" + mediaPath[1] + "}}";
  }
  /**
   * Convert an image URL to a background image data uri
   *
   * @param {string} imageUrl
   * @returns {string}
   */


  function imageToBackgroundImageDataUrl(imageUrl) {
    return "url(\'" + (0, _directives.toDataUrl)(urlToDirective(imageUrl)) + "\')";
  }

  return {
    decodeUrl: decodeUrl,
    urlToDirective: urlToDirective,
    imageToBackgroundImageDataUrl: imageToBackgroundImageDataUrl
  };
});
//# sourceMappingURL=image.js.map

Spamworldpro Mini