草庐IT

image_file

全部标签

php - imagecreatefromstring 使用带有数据 :image/png;base64, 的图像

我将图像存储为以以下内容开头的字符串:data:image/png;base64,我需要将它转换为普通图像以便与GD一起使用。我试过imagecreatefromstring()但它似乎只接受没有data:image/etc前缀的图像。我该怎么办? 最佳答案 $exploded=explode(',',$data,2);//limitto2parts,i.e:findthefirstcomma$encoded=$exploded[1];//pickupthe2ndpart$decoded=base64_decode($encoded

php - "./file"和 "file"相对路径有什么区别

我总是看到开发人员使用这两种类型的相对路径来包含外部文件。问题是,“require"./lib/helpers.php"和require"lib/helpers.php"据我所知,两者都指向同一个文件。但是,就复杂性而言,一个是否优于另一个?问候 最佳答案 ./lib/...将包含请求锚定在脚本的当前工作目录中。PHP将在那里寻找所需的文件,而不会在其他地方寻找。如果不存在,则不执行包含并继续执行。lib/...允许PHP扫描其包含路径,例如如果你有include_path=.:/var/lib/php:/foo/bar/baz然后

php - file_get_contents 同步或异步

今天遇到一种情况。我正在使用file_get_contents为用户从文件中获取token。$data=file_get_contents("http://example.com/aaa.php?user=tester&akey=abcdef1234");$dec=json_decode($data,true);$tokenid=$dec['message']['result']['tokenid'];使用token我将调用另一个文件来获取详细信息;$data=file_get_contents("http://example.com/bbb.php?user=tester&token

php - 当我添加 'files' => true 时,Laravel 表单不返回输入

我有一个看起来像这样的表格:{{Form::open(array('route'=>'notebook.store','files'=>true))}}{{Form::text('title',null,['class'=>'form-control','placeholder'=>'Title',])}}{{Form::text('description',null,['class'=>'form-control','placeholder'=>'Desc',])}}{{Form::file('path')}}{{Form::submit('Save',['class'=>'btnb

php - 未捕获的异常 'ImagickException',消息为 'Unable to read the file'

我正在运行带有imagick模块3.1.0RC2的PHP5.4.30。phpinfo()确实将模块显示为已加载,而phpinfo()将PDF显示为受支持的格式。运行时:$image=newImagick();$image->readImage('./test.pdf');我收到:fatalerror:未捕获的异常“ImagickException”和消息“无法读取文件:./test.pdf”当我将图像类型更改为JPEG并读取'./test.jpg'时,未返回任何错误。已检查权限并测试了不同的PDF。我已经插入了图像的绝对路径,但仍然抛出异常。此示例的图像与脚本放在同一目录中。我错过了什

php - 如何修复错误 "Fatal error: Uncaught --> Smarty: unable to write file"?

我使用digitalocean将Prestashop从本地主机迁移到网站域,但是当我打开该网站时出现此错误Fatalerror:Uncaught-->Smarty:unabletowritefile/var/www/html/prestashop/cache/smarty/compile/a4/36/f1/wrt549a35e49b3b44_77591243我尝试将smarty文件夹的权限更改为755,但没有成功。我不知道如何修复它。 最佳答案 你的问题肯定是关于权限的。这取决于Apache和PHP的设置方式。首先,检查谁拥有这些文

PHP file_get_contents() : content truncated from 2147483648 to 2147483647 bytes

当我要创建2GB文件的zip文件时,如何找出问题。错误file_get_contents():contenttruncatedfrom2147483648to2147483647bytesFatalerror:Outofmemory(allocated2151677952)(triedtoallocate18446744071562067968bytes)in我正在使用专用服务器并且已经设置了memory_limit,max_execution_time,max_upload_filesize,max_post_size。但这对我不起作用。请检查我的代码并让我知道我做错了什么-创建新的

php - Laravel 5 Elixir : How to mix copy multiple files

如何使用Elixir混合复制多个文件?这不起作用:mix.copy([['node_modules/vue/dist/vue.js','resources/assets/js/vendor/vue.js'],['node_modules/vue-resource/dist/vue-resource.js','resources/assets/js/vendor/vue-resource.js']]);任何其他建议,除了:mix.copy('node_modules/vue/dist/vue.js','resources/assets/js/vendor/vue.js');mix.cop

PHP-file_get_contents() : Filename cannot be empty

有人可以帮我处理这个错误吗?我不知道用什么方法或方法来摆脱这个错误。我是php的新手并开始学习它。有人可以给我想法吗?这里是错误:这是我的PHP代码。"enctype="multipart/form-data">Title"/>Date"/>Content"alt="yourimage"style="width:200px;height:140px;"/>functionreadURL(input){if(input.files&&input.files[0]){varreader=newFileReader();reader.onload=function(e){$('#blah')

php - MpdfException 图片错误 () : Error parsing image file - Yii2

我陷入了非常尴尬的境地,图像在生成PDF时显示在本地环境中。但是,不在生产中。使用mPDF生成PDF时图像显示为[X]。在Controller中插入$mpdf->showImageErrors=true;之后。publicfunctionactionExportCasesPdf($id){....$mpdf=new\mPDF();$mpdf->showImageErrors=true;$mpdf->WriteHTML($output);$mpdf->Output($fileName,'D');}错误MpdfExceptionIMAGEError(..17.jpg):Errorparsi