I'm having a hard time explaining this. When I select an image html page, the script scans for %% identifiers and creates the appropriate thumbnail size with an html gallery page for it. The problem is the html gallery. I'm trying to use the image html page as the output, not a default template from $str.
image html page
<table>
<tr>
<td>%image.200.200%</td>
<td>%image.100100%</td>
</tr>
<tr>
<td>%image.300.200%</td>
</tr>
</table>
$str="";
$gallery_path='galleries/';
$template_path='/image_template/';
$folder="students";
$template=$_POST['template'];
$dir=stripslashes($full_dir_path).$gallery_path.$folder."/";
$filename=stripslashes($full_dir_path).$template_path.$template;
$handle = fopen($filename, "a+");
$contents = fread($handle, filesize($filename));
$pageexplode=explode("%image.",$contents);
$i=0;
$width=array();
$height=array();
$num=0;
//setting height and width for the images to be cropped as per the choosen templtate
//for each strts
foreach($pageexplode as $a)
{
$d=explode("%", $a);
foreach($d as $e);
{
$x=explode(".", $d[0]);
if(isset($x[1]))
{
// echo $x[0] . $x[1] . "<br>";
$width[]=$x[0];
$height[]=$x[1];
}
}
} //foreach ends
//checcking image in posted folder
$img=array();
if ($dh = opendir($dir)) {
while (($file_name=readdir($dh)) !== false) {
if ((substr($file_name, strlen($file_name) - 4) == '.jpg') && (substr($file_name,0,3)!='tn_'))
{
$img[]=$file_name;
}
}
}
$l=count($width);
$new_files=array();
$images="";
for($i=0;$i<$l;$i++)
{
if(isset($img[$i]))
{
$file=$img[$i];
list($old_width, $old_height) = getimagesize($dir.$file);
$new_width=$width[$i];
$new_height=$height[$i];
$save_as=$dir."tn_".$file;
createFixedCropThumbnail($dir."/$file",$dir."/tn_".$file,$new_width,$new_height);
}
}
fclose($handle);
$str.="<table>\n";
$str.="<tr>\n";
for($j=0;$j<$l;$j++)
{
$str.='<td><a href="'.$img[$j].'"><img src="tn_'.$img[$j].'" border="0"></a></td>';
}
$str.="</tr>\n";
$str.="</table>\n";
$page=$dir."index.php";
The html output:
<table>
<tr>
<td>repeated image tag that's been thumbnailed</td>
<td>repeated image tag that's been thumbnailed</td>
<td>repeated image tag that's been thumbnailed</td>
<td>repeated image tag that's been thumbnailed</td>
</tr>
</table>
Is there a way I can make the html output generate the same image html page so the output would look like this:
<table>
<tr>
<td>repeated image tag that's been thumbnailed</td>
<td>repeated image tag that's been thumbnailed</td>
</tr>
<tr>
<td>repeated image tag that's been thumbnailed</td>
</tr>
</table>