小编Ken*_*app的帖子

用php检测空白生成的图像?

如何使用PHP和/或imagemagick检测图像是空白的(只有单个,任意颜色,或使用gif,随机任意颜色的帧)?

我想这就是我要尝试的:http: //www.php.net/manual/en/function.imagecolorat.php#97957

php imagemagick

7
推荐指数
1
解决办法
1723
查看次数

canvas toDataURL 不返回完整图像

我正在构建一个 jQuery 插件,它为图像添加水印(是的,我很清楚 javascript/html5 水印系统的众多缺点,但现在暂时忽略它。)每个图像的基本方法是:

  • 将图像粘贴到画布的背景
  • 在其上添加水印图像的数据,
  • 将原始图像的 src 替换为画布(现在包含水印)的 src。

现在,如果我用画布本身替换图像元素,它似乎工作正常......所有元素都出现在画布上。但是当我获得画布的 dataURL 时,除了绘制在它上面的最后一个图像之外的所有内容都会出现。我什至不介意这个插件也需要替换图像的链接,因此用数据 url(带水印)替换 hrefs。

这是当前的代码:

(function($){

    $.fn.extend({

        cmark: function(options) {

            var defaults = {
                type: 'image',
                content: 'watermark.png',
                filter: 'darker',
                scale:300,
                box: {
                    top         :   0.5,
                    left        :   0.5,
                    width       :   0.75,
                    height      :   0.75,
                    bgcolor     :   '#000000',
                    bgopacity   :   0.5,
                    fgopacity   :   1
                },

                callback_unsupported: function(obj){
                    return obj;
                }

            }

            var getScale = function(w, h, scale){
                ratio = Math.min(scale/w, scale/h);
                scalew = Math.round(ratio*w);
                scaleh = Math.round(ratio*h);
                return …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery canvas

5
推荐指数
1
解决办法
5930
查看次数

标签 统计

canvas ×1

html ×1

imagemagick ×1

javascript ×1

jquery ×1

php ×1