相关疑难解决方法(0)

MySQL中的图像

MySQL中是否有与图像相关的数据类型,可用于存储每条记录的图像.感谢您的帮助.

干杯! 阿尼尔

mysql

8
推荐指数
4
解决办法
2万
查看次数

LOAD_FILE 返回 NULL

我正在尝试将图像插入到我的 MySQL 服务器中。我做了一些研究,看起来最好的方法是通过LOAD_FILE(). 但是,LOAD_FILE()始终返回 null。我知道有 4 个条件LOAD_FILE()

  1. 该文件必须位于服务器主机上
  2. 您必须指定文件的完整路径名,并且您必须具有 FILE 权限。
  3. 该文件必须可供所有人读取并且其大小小于 max_allowed_pa​​cket 字节。
  4. 如果secure_file_priv 系统变量设置为非空目录名,则要加载的文件必须位于该目录中。

我目前正在使用:

select LOAD_FILE('/Users/pricedb/Desktop/FolderName/imageName');
Run Code Online (Sandbox Code Playgroud)

它返回NULL

我已经确认所有权限都授予用户。文件必须位于服务器主机上是什么意思?服务器正在我的本地计算机上运行,​​并且文件位于那里,这是否意味着我很擅长?

任何建议将不胜感激,我不知道为什么它没有返回值。

mysql null mysql-loadfile

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

使用android存储和检索来自WAMP服务器的图像

我有一个Android应用程序,其中管理员用户可以创建普通用户帐户,其中管理员用户可以选择普通用户的照片来创建帐户.在存储普通用户名,年龄ETC之前,情​​况正常.但是当我想将普通用户的图像存储到数据库时出现问题.我使用Wamp服务器作为后端数据库.

你能告诉我如何在WAMP服务器中存储图像以及如何再次检索它以便我可以在Android活动上显示.

功能如,管理员用户登录---->创建普通用户 - >选择图像 - >存储在数据库中.

普通用户登录--->从数据库中检索图像 - >在Android活动中查看图像.

php mysql android image wampserver

3
推荐指数
1
解决办法
5340
查看次数

在数据库mysql中保存图像

我的客户在php + mysql中创建了一个脚本,可以直接在数据库中保存图像,每个图像都有这样的URL:www.example.com/image.php?id = 421

在您看来,这是一个非常错误的解决方案?我应该重建所有网站吗?

每天大约有1000次访问,数据库中有大约600张图像.

php mysql database image

2
推荐指数
1
解决办法
2463
查看次数

在MySQL中存储图像

请给我查询在MySQL数据库中插入图像.我是stackoverflow的新手,所以如果我的问题没有达到标记,请忽略我.

mysql

2
推荐指数
2
解决办法
2万
查看次数

如何使用CodeIgniter在数据库中存储和检索图像

我正在使用WAMP服务器,我想使用CI在数据库中上传图像.数据库中的图像变量是blob数据类型.我的问题如下:

1)如何存储图像而不是文件名以及我应该使用哪些数据类型?

2)如何从数据库中检索图像?

我的控制器代码:

<?php class Image_control extends CI_Controller{
function index()
{
    //$this->load->view('image_view');

    //$this->Image_model->do_upload();

    $data['images']=$this->Image_model->get_images();
    $this->load->view('image_view',$data);  
}
function do_upload()
{
    $config = array(
        'allowed_types' => 'jpg|png|bmp', 
        'upload_path'=>'./images1/',
        'max_size'=>2000
    );
    $this->load->library('upload',$config);
    if (!$this->upload->do_upload()) {
        $errors[]=array('error'=>$this->upload->display_errors());
        $this->load->view('image_view',$errors);
    }
    $image_path=$this->upload->data();
    $file_name=$image_path['file_name'];
    $config = array(
        'a_name' => $this->input->post('a_name'),
        'a_details'=>$this->input->post('a_info'),
        'a_photo'=>$file_name
    );
    $insert=$this->db->insert('animalstore',$config);
    return $insert;
}   
}
?>
Run Code Online (Sandbox Code Playgroud)

我的模特的代码:

<?php class Image_model extends CI_Model {
function get_images()
{
    $query = $this->db->get('animalstore');
    if($query->num_rows > 0 )
    {
        foreach($query->result() as $rows)
        {
            $data[] = $rows;
        }
        return …
Run Code Online (Sandbox Code Playgroud)

php mysql html5 codeigniter

2
推荐指数
1
解决办法
2万
查看次数

文件名不能为空

每当我点击“提交”按钮时,我都会收到此错误。其他所有内容都提交给数据库,只有图像没有提交。警告:file_get_contents():文件名不能为空任何想法?这是我的代码。

if(isset($_POST['consultationbutton'])){        
    $image = addslashes(file_get_contents($_FILES['selectedfile']['tmp_name'])); //SQL Injection defence!
    $image_name = addslashes($_FILES['selectedfile']['name']);
    $checkedcondition = implode(",",$_POST['skincondition']);
    $checkedproduct = implode(",",$_POST['skincareinuse']);
    $consultquery="INSERT INTO counsel(nric,dateconsulted,editableface,skincarecurrentlyinuse,skincondition,imagename) VALUES('132','$_POST[storedate]','{$image}','$checkedproduct','$checkedcondition','{$image_name}')";
    mysqli_query($dbconn,$consultquery);
   // mysqli_escape_string($dbconn,$image);
    echo $checkedcondition;
    echo $checkedproduct;
}   

<form action="BAConsult.php" enctype="multipart/form-data" method='post'>
<img id="customerface" src="#" alt="your image" class ="consultimg"></img>
 Select a file to upload: <input type="file" name="selectedfile" onchange="readURL(this);">
<input type='submit' name='consultationbutton' class='consultationbutton' value='Complete Consultation' onclick='submitclick();'>
</form>

<script>
function readURL(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();

        reader.onload = function (e) {
            $('#customerface')
                .attr('src', e.target.result)
                .width(400) …
Run Code Online (Sandbox Code Playgroud)

php image file

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

标签 统计

mysql ×6

php ×4

image ×3

android ×1

codeigniter ×1

database ×1

file ×1

html5 ×1

mysql-loadfile ×1

null ×1

wampserver ×1