Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
MongoDBとGridFSを使用していますが、displayというページの画像タグに含めることができるようにしたいと思います。getimage.phpはMongoから画像を取得したページです。<img src='getimage.php' height='100px' width='100px'>
<img src='getimage.php' height='100px' width='100px'>
これは可能でしょうか?もしそうなら、それに対する含意は何でしょうか?
使用getimage.phpするだけでは不十分です。取得する画像の識別子も指定する必要があります。このようにして、この手法を無制限の数の画像に使用できます。
getimage.php
<img src='getimage.php?oid=4rf55...' height='100px' width='100px'>
ファイルOIDを使用すると、GridFSから画像を簡単に取得できます。では、 paramで指定getimage.phpされた値に基づいて画像を取得するだけです。oid=....$oid = $_GET['oid']
oid=....
$oid = $_GET['oid']