当图像具有随机名称和扩展名时,如何从文件夹中选择图像? [英] How to select image from folder, when image has random name and extension?

查看:75
本文介绍了当图像具有随机名称和扩展名时,如何从文件夹中选择图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我需要从会员文件夹中选择图片,将其设置为个人资料图片。问题是我不知道该怎么做,因为该图像没有固定的名称或扩展名,所以每次都有不同的名称。我需要使用PHP,例如:

Hello,

I need to select image from a member folder to set it as their profile image. The problem is that I don''t know how to do this, because that image has no fixed name or extension, so every time there is a different name for it. I need to use PHP for this, something like:

展开 | 选择 | Wrap | 行号

推荐答案

当你上传图片,你应该用图片的路径更新用户记录。
When you upload the image, you should update the user record with the path of the image.


你好兔子,


你的意思是,我应该创建一个类似profile_image的字段其中包含图像的路径?


所以说我有一个字段profile_image字段设置为VARCHAR,并且路径为默认图像长度/值" members / default.jpg"


那么我只会使用类似的东西:
Hi Rabbit,

Do you mean that, I should create a field like "profile_image" which contains path to the image?

So say I have a field "profile_image" Field set to "VARCHAR" and with path to default image as Length/Values "members/default.jpg".

So then I would just use something like:
展开 | 选择 | Wrap | 行号


您将使用UPDATE而不是INSERT。但这是一般的想法,是的。
You would use UPDATE rather than INSERT. But that''s the general idea, yes.


这篇关于当图像具有随机名称和扩展名时,如何从文件夹中选择图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆