简体   繁体   English

如何将图像上传到具有CSS过滤器的服务器

[英]how to upload an image to a server with the css filters on it

i have found a pack of css filter that you can use on pictures with just specifying the id of the filter on the image. 我发现了一包css过滤器,只需在图像上指定过滤器的ID,即可在图片上使用。 right now i want to create a button that will let me send the edited picture(the picture with the filter) to a file where i put the pictures i'm using a Uniform server to run my php can anyone help ? 现在我想创建一个按钮,让我将编辑后的图片(带有过滤器的图片)发送到一个文件,在该文件中,我使用统一服务器运行php的图片可以供任何人使用?

CSS filters are never exported along with the canvas. CSS过滤器永远不会与画布一起导出。

Native canvas has some compositing & blending filters . 本机画布具有一些合成和混合过滤器

But, beyond that, you must apply the filter to the canvas itself. 但是,除此之外,您必须将滤镜应用于画布本身。 This is done by: 这是通过以下方式完成的:

  1. Fetching the image's pixel data with context.getImageData , 使用context.getImageData获取图像的像素数据,
  2. Manipulating the pixel data according to your filter algorithm, 根据您的过滤器算法处理像素数据,
  3. Replacing the modified pixels back on the canvas with context.putImageData . context.putImageData将修改后的像素替换回画布上。

You can explore the many filter algorithms by Googling "html5 canvas filters". 您可以通过谷歌搜索“ html5 canvas过滤器”来探索许多过滤器算法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM