I have a mysterious problem with the useage of the following PHP call on a particular ISP.
I have used this and similar code many times on other websites without any issues at all.
What it does
Very simple, replace the words 'IMAGE_NAME' with the relative path and name of your image and the PHP script prints to screen, the image but reduced so that it's maximum dimension = 100.
The problem
I pick 12 picture names from a database and loop through them, calling the PHP code each time with the image name inserted into the imnam= variable. The 12 images attempt to print but only 7 of them do.
Getting them all to display
If I copy the code from one of the non-displayed pictures, put it into the address bar and return to the original page, all the images are now displayed.
I am looking for possible reasons why this is happeneing.
It may be worth mentioning that the code is being called using SSI via a Perl script although I have done the same thing on 100's of occasions, on other ISP's, without this issue.
The ISP are a waste of space when it comes to anything which helps a developer, they would rather just host people with 3 page static sites and hope they don't ask anything complicated.
Has anyone come across this issue before?
Keith
I have used this and similar code many times on other websites without any issues at all.
What it does
Very simple, replace the words 'IMAGE_NAME' with the relative path and name of your image and the PHP script prints to screen, the image but reduced so that it's maximum dimension = 100.
The problem
I pick 12 picture names from a database and loop through them, calling the PHP code each time with the image name inserted into the imnam= variable. The 12 images attempt to print but only 7 of them do.
Getting them all to display
If I copy the code from one of the non-displayed pictures, put it into the address bar and return to the original page, all the images are now displayed.
I am looking for possible reasons why this is happeneing.
It may be worth mentioning that the code is being called using SSI via a Perl script although I have done the same thing on 100's of occasions, on other ISP's, without this issue.
The ISP are a waste of space when it comes to anything which helps a developer, they would rather just host people with 3 page static sites and hope they don't ask anything complicated.
Has anyone come across this issue before?
Code:
<img border='1' title='title' style='float:left;' src="sitename/script.php?imnam=IMAGE_NAME&maxwid=100&maxhi=100" alt=''>
Code:
<?php
$img_name=$_GET['imnam'];
$origsize=GetImageSize($img_name);
$max_wid=$_GET['maxwid'];
$max_ite=$_GET['maxhi'];
$Fonts=$_GET['norat'];
$src_img = ImageCreateFromJPEG($img_name);
$width_ratio = ($origsize[0] / $max_wid);
$height_ratio = ($origsize[1] / $max_ite);
if($width_ratio >=$height_ratio)
{
$ratio = $width_ratio;
}
else
{
$ratio = $height_ratio;
}
$new_width = ($origsize[0] / $ratio);
$new_height = ($origsize[1] / $ratio);
$new_width = round($new_width);
$new_height= round($new_height);
$thumb = ImageCreateTrueColor($new_width,$new_height);
$grey = imagecolorallocate($thumb, 201, 201, 201);
$white = imagecolorallocate($thumb, 255, 255, 255);
$offse=4;
ImageCopyResampled($thumb, $src_img, 0,0,0,0,($new_width),($new_height),$origsize[0],$origsize[1]);
$im = imagecreatefrompng('owlmark.png');
imagecopymerge ($thumb , $im , 0 , 0 , 0 , 0 , 250 , 250 , 20 );
ImageJPEG($thumb);
ImageDestroy($thumb);
?>
Keith