As title.

For example the image URL field could be updated as soon a file is uploaded.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lolandese’s picture

See https://www.drupal.org/node/752056.

We could also include in the demo the opacity slider affecting the image URL preview directly.

MageshwaranN’s picture

document.querySelector('input[type="range"][name="FOO_img_opacity"]').onchange=changeEventHandler;

function changeEventHandler(event) {
var opacity = event.currentTarget.value;
var fallbackOpacity = parseFloat(opacity) * 100;
var imageElement = document.querySelector('img[id="FOO_imgurl-image-preview"]');
imageElement.style.opacity = opacity;
imageElement.style.filter = 'alpha(opacity='+fallbackOpacity+')'; // IE fallback
};

You can add this js snippet on the demo module.

lolandese’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Active » Needs review
FileSize
1.32 KB

Rolled Magesh's snippet into a patch.

lolandese’s picture

Status: Needs review » Fixed

Committed with contribution.

Thanks Magesh.

lolandese’s picture

Status: Fixed » Active

Reopened for the original request to have AJAX when changing the image.