开发者

Seamless image replacement / update

开发者 https://www.devze.com 2023-04-09 05:25 出处:网络
I am creating a multi-layered image editor using AJAX to send calls to a PHP script, then using a GD library to process the changes, save the new image and send the new image path back to the browser

I am creating a multi-layered image editor using AJAX to send calls to a PHP script, then using a GD library to process the changes, save the new image and send the new image path back to the browser for AJAX to replace old with new.

This example, when you move a layer it 开发者_运维百科seamlessly moves the layer without a single flicker of the image. This example uses a dll file to serve the image, I want to be able to achieve the same thing in PHP / JS.

Idea 1 I thought about applying a z-index to the current image and load the new image below it, once it's loaded, hide the old image.

Idea 2 Set the image path to a php script which outputs the raw data of the compiled image direct to the browser.


if you want to replace the image "without a single flicker", just preload the image
(load the image to a hidden img element or a Image javascript object and then show it on an onload callback)

0

精彩评论

暂无评论...
验证码 换一张
取 消