<p><code>
So my question is How to effectively use BLOB and for which purposes it is suitable?
</code></p>

<p>Quick and dirty answer</p>

<p><code>
The simple answer is: BLOBs smaller than
256KB are more efficiently handled by a database,
while a filesystem is more efficient for those greater
than 1MB. Of course, this will vary between
different databases and filesystems
</code></p>

<p>There is a microsoft technical report here : <a href="https://arxiv.org/ftp/cs/papers/0701/0701168.pdf" rel="nofollow noreferrer">Compare blob and ntfs filesystem</a> . The report is quite old (2006) but i think there isn't any much change from there. </p>

<p>Imaging when you want to read file which stored in blob. you have send request to your database software, then the software controller will read blob data which is stored in filesystem. Instead of directly read from file-system, you have to go through 2 steps processes. So when the size of your file become bigger, blob will slow down your database a lot. And we all know that speed is the main key for database.</p>

<p>Hope that help</p>
How to deal with BLOB?
<p>What I know, in Database Context, BLOB or Binary Large OBject is nothing but actually a stored binary code for a given data. Can Reserves spaces in GBs and can be used to store virtually any data type. But What's actually a use of it?</p>

<p>My major is Computer Vision and I'm fairly novice at databases and web development. Currently, I'm working on a sentiment analysis project and want to collect a large dataset for this purpose i.e. huge number of images and also want to keep record of whether a image has been used for the analysis purpose or not. I thought storing images in database with separate column for access record is the best thing I can do to have an organized and systematic approach. But Everyone I talked with recommends not to store image as a blob in database but  just have its URL or name there and should have images in a dedicated folder.</p>

<p>Moreover, since BLOB is just binary encoding of a file how would we decode it into an image file? I found codes like following to convert a BLOB value into an image:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>echo '&lt;img src="data:image/png;base64,' .  base64_encode($image-&gt;getimageblob())  . '" /&gt;';</code></pre>
</div>
</div>
</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>echo '&lt;img src="data:image/jpg;base64,' .  base64_encode($image-&gt;getimageblob())  . '" /&gt;';</code></pre>
</div>
</div>
</p>

<p>But these codes are specific to the extension (And personally I haven't been successful with any such codes). As all extensions for sure have some different schemes and thus a code cannot be used for image of all those extensions. My dataset targets visuals of an image and not on extension thus contains images of various extensions so how can one deal with them using a BLOB?</p>

<p>So the approach of storing just names in database and and images in a dedicated folder sounds good but then what is the use of database itself? Can not we have some renaming mechanism for images via PHP and store them directly into that folder. Why use database when we can rename images like <strong>img_1_accesses_5.png</strong> and split image name to get the ID and number of times it accessed?</p>

<p>If BLOB can store virtually every type of data, why the use of BLOB is such horrible and everyone recommends not to use it? And what is the problem if we directly inject images into database as BLOB? And finally If its suitable for images then how to deal with it?</p>

<p>So my question is <strong>How to effectively use BLOB and for which purposes it is suitable?</strong></p>