douduikai0562 2010-11-22 09:28
浏览 33
已采纳

在mysql中保存图像名称?

Currently i have system that's do resizing and creating as many images as needed and storing them on web servers file system. Also i make and entry in database of image basename in mysql. For example i upload 5 images the basename would be 372FDSC and then it will add _0, _1 etc. to each image in filesystem so it makes image look like 372FDSC_0.jpeg and so forth.

So where is my problem? It's that i cannot delete or upload new images since i don't know image name in code.

I wonder is there is some better solution to save image names for article? Like mysql row that holds all names (372FDSC_0.jpgeg;372FDSC_01.jpeg etc.) So when i delete or upload new ones i know what filename i can use.

I hope this all makes some sense to anyone if not please say and i'll add required details.

  • 写回答

4条回答 默认 最新

  • dongxian1921 2010-11-22 09:40
    关注

    You could use a timestamp at the end of the image name, so you're sure it's unique.

    $new_name = $basename . "_" . time() . $extension;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥50 求解vmware的网络模式问题
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳
  • ¥15 springboot 3.0 实现Security 6.x版本集成
  • ¥15 PHP-8.1 镜像无法用dockerfile里的CMD命令启动 只能进入容器启动,如何解决?(操作系统-ubuntu)
  • ¥30 请帮我解决一下下面六个代码
  • ¥15 关于资源监视工具的e-care有知道的嘛
  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?