Best way to name thumbnails and look them up in PHP
<p>This PHP code below will take an image and add the word <strong>_thumb</strong> in between the filename and file extension </p>

<p>This file is called up to 50 times on some pages to show user photo, please not I only linked to a full path image on another server for this example, the file path is usually pulled from a Mysql DB that stores the path to a users photo  </p>

<p>I am currently restructuring a lot of things on my site though and I am wanting to know if this is a bad way?</p>

<p>I store a thumbnail image like this:<br />
<strong>filename_thumb.jpg</strong>  </p>

<p>So on a page to view a thumbnail, I only have the path to the full size image and I must add the _thumb part into the filename before displaying the image to screen.</p>

<p>Would it be better performance to do something like<br />
<strong>t_</strong>filename.jpg  </p>

<p>The data that come from the database is like this:<br />
user/photos/1/23/45/34/filename.jpg  </p>

<p>So if I changed where I add the thumb part to the fron of the name would it still have to run all the code below to get a result? Please notice how the path I get from the DB is not JUST a filename it has the folder structure saved into it as well and the folders are always different.</p>

<pre><code>&lt;?php

$file = 'http://file-managers.net/skins/blue/images/actions/view_tree.png';
$fil_ext1 = pathinfo($file);
$fil_ext = $fil_ext1['extension']; 
$fil_explode = '.' . $fil_ext;
$arr = explode($fil_explode, '/skins/blue/images/actions/view_tree.png');
$pic1 = $arr[0] . "_thumb" . $fil_explode;

// will show;
// /skins/blue/images/actions/view_tree_thumb1.png
echo $pic1;

?&gt;
</code></pre>
