草庐IT

canvas2image

全部标签

javascript - Canvas toDataUrl 增加图像的文件大小

当使用toDataUrl()设置图像标签的来源时,我发现保存的图像比原始图像大很多。在下面的示例中,我没有为toDataUrl函数指定第二个参数,因此使用了默认质量。这导致图像比原始图像尺寸大得多。当为全质量指定1时,生成的图像甚至更大。有谁知道为什么会发生这种情况,或者我该如何阻止它?//createimagevarimage=document.createElement('img');//setsrcusingremoteimagelocationimage.src='test.jpg';//waittilithasloadedimage.onload=function(){//s

javascript - Canvas toDataURL() 返回空白图像

我正在使用glfx.js编辑我的图像,但是当我尝试使用toDataURL()函数获取该图像的数据时,我得到一个空白图像(宽度与原始图像大小相同)。奇怪的是,在Chrome中脚本运行完美。我想说的是,图像是使用onload事件加载到canvas中的:img.onload=function(){try{canvas=fx.canvas();}catch(e){alert(e);return;}//converttheimagetoatexturetexture=canvas.texture(img);//drawandupdatecanvascanvas.draw(texture).upd

javascript - 在不知道字体系列的情况下更改 Canvas 的字体大小

有没有办法只更改Canvas上下文的字体大小而无需知道/编写字体系列。varctx=document.getElementById("canvas").getContext("2d");ctx.font='20pxArial';//Needtospeficybothsizeandfamily...注意:ctx.fontSize='12px';//doesn'texistsowon'twork...ctx.style.fontSize='20px'//doesn'texistsowon'twork...//wearechangingthectx,notthecanvasitself其他注

php - 使用 laravel 存储与图像干预 canvas()

使用Vagrant和Homestead运行Laraval5.4。看到了一些关于此问题的其他问题,但没有一个提供使用canvas()的解决方案干预方法/图像Laravel引入了一个easierstoragesystemsince5.3我当前的代码:$path=$request->file('logo')->store('/clients/logos','public');$canvas=Image::canvas($width,$height);$image=Image::make($path)->resize($width,$height,function($constraint){$

php - 删除 wp_get_attachment_image 图像大小

有什么方法可以去掉wp_get_attachment函数的图片大小吗?我尝试了以下代码但没有运气,试图让它100%或根本没有。echowp_get_attachment_image($variable,array(100.'%',100.'%'));编辑感谢drew010,这就是我最终得到的完美效果。echo''; 最佳答案 @Jrod在我看来是正确的答案,但你也可以打电话wp_get_attachment_url($variable);它为您提供了完整图像的URL。然后您可以简单地构建自己的HTML标记来显示图像。

image - 代码发送了 2 次,但没有正确的图像

我尝试了帖子中的这段代码,但这段代码在一次文件运行中发送了两封电子邮件。Emailfileissendingemailtwotimesusingphpmailfunction让我知道我做错了什么-MyTitle'.mytextoverimage('Developer').'';mail($to,$subject,$message,$headers);die;让我知道我做错了什么,这是我使用的正确方法吗--我关注了这个URL,但很难从这个页面找到任何帮助-http://php.net/manual/en/function.imagejpeg.php我什至尝试将该方法mytextoveri

php - 使用 GD 或 Imagick 扩展图像 Canvas

假设我有一张200x100的图片,我将其调整为100x50://imagick$imagick->resizeImage($width,$height,Imagick::FILTER_UNDEFINED,1)//gd$image=imagecreatetruecolor($width,$height);imagecopyresampled($image,$src,0,0,0,0,$width,$height,imagesx($src),imagesy($src)))但我希望图像为120x120。如何将Canvas扩展到该大小,但将我刚刚调整大小的图像保持在中心的相同尺寸?类似于Imag

javascript - html2canvas - 错误 - 对象 HTMLCanvasElement

我需要使用javascript打印div..这个div的内容是生成的条形码..使用打印div元素的正常方法不起作用,因为条形码图像是由php文件生成的,不会出现在打印页面中。所以我决定使用html2canvas方法来“渲染”div然后打印出来..这是我的代码:HTML:SomecontentandimgofbarcodeJavaScript:functioncapture(){html2canvas([document.getElementById('source')],{onrendered:function(canvas){varmywindow=window.open('','m

php - 未捕获的异常 'ImagickException',消息为 'Compare images failed'

这是我第一次使用ImageMagick,我正在做一个小测试,看看它是否真的能满足我的要求;但是,我收到错误“比较图像失败”。很可能我做错了什么,因为我真的不知道Imagick是如何工作的。我对其他建议持开放态度,我只想比较两个几乎没有变化的图像。我的测试代码如下所示:readImage("export/image1.jpg");$image2->readImage("export/image2.jpg");$result=$image1->compareImages($image2,1);$result[0]->setimageFormat("jpg");echo$result[1].

php - 如果函数中使用的图像返回错误,如何获得 "no image found"图标?

在我的应用程序中,我使用timthumb来调整图像大小。这些图像不受我控制,因为我是从RSS提要中获取它们的。有时图像没有显示在我的页面中。当我用timthumb检查整个链接时,我得到了这个Warning:imagecreatefromjpeg(http://www.domain.com/image.jpg)[function.imagecreatefromjpeg]:failedtoopenstream:HTTPrequestfailed!HTTP/1.1404NotFoundin/timthumb.phponline193Unabletoopenimage:http://www.d