Note that there are some explanatory texts on larger screens.

plurals
  1. PODealing with image upload (keeping track) PHP
    primarykey
    data
    text
    <p>In my site I will let users upload product images and each product image will have different versions of varying sizes. How do you suggest I keep track of all these images so I can easily deal with insertions and deletions?</p> <p>The system that I have coded at the moment basically records image data (paths, sizes, date, etc) in a DB row on upload. Images file names are generated by </p> <pre><code>md5( microtime() ) . $this-&gt;auth-&gt;user_id; // 55bedba35a57c710e73fee21106006b71 </code></pre> <p>and paths like this:</p> <pre><code>'./img/'.substr($file_name,0,1).'/'.substr($file_name,1,1).'/'.substr($file_name,2,1); // /img/5/5/b </code></pre> <p>so its</p> <pre><code>// /img/5/5/b/55bedba35a57c710e73fee21106006b71.jpg </code></pre> <p>That is for each "image" (the original image). I'm still not sure how to go about recording the versions.</p> <p>The thing is I'm a bit paranoid about integrity so the thought of somehow images getting deleted but still having records or having images with no record bothers me.</p> <p>Is there anything (library or something) that can help me connect the DB - Filesystem gap?</p> <p>I'm working with CodeIgniter if that is of any help</p> <p>Thanks in advance. Please let me know if I didn't make any sense, heh.</p> <p><strong>EDIT</strong></p> <p>I'm thinking of storing the original as a blob in the database then generating variations and placing them all in the same folder. This way I think it might be easier to regenerate all images in case of missing images and delete the folder to delete all files when necessary. This would probably make my DB size unbearable no? What do you think?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload