- Impact
- 8
Hi guys,
I'm trying to modify the counter code script to use .jpg filenames instead of the standard .png filenames to help speed counter image loading times up a bit. I'm having a problem getting "imagecreatefrompng" to work properly. I have changed all references of .png to .jpg and all remaining references of png to jpeg (the ones that don't call a file name.ext). The server has GD ver. 2.0.28 with jpeg support installed.
admin.php
core.class.php
counter.class.php
imagetest.php
Any help with this would be appreciated.
I'm trying to modify the counter code script to use .jpg filenames instead of the standard .png filenames to help speed counter image loading times up a bit. I'm having a problem getting "imagecreatefrompng" to work properly. I have changed all references of .png to .jpg and all remaining references of png to jpeg (the ones that don't call a file name.ext). The server has GD ver. 2.0.28 with jpeg support installed.
admin.php
Code:
for ($i = 1; $i < $total; $i++){
$filename = "images/" . ${i.$i.filename} . ".jpg";
if (is_file($filename)){
mysql_query("UPDATE CC_image SET id=".${i.$i.id}.", filename='".${i.$i.filename}."', xpos=".${i.$i.xpos}.", ypos=".${i.$i.ypos}.", is_stealth='".${i.$i.is_stealth}."' WHERE id=".${i.$i.id}) or $error=mysql_error();
} else {
$error .= $filename . " " . $lang['counter_not_found1']."$id".$lang['counter_not_found2']."<br><br>";
break;
core.class.php
Code:
$output.= "> </td><td nowrap><img src=images/" . $this->d->filename . ".jpg alt='counter no " . $this->d->id . "'>";
if($this->d->is_stealth == 1)
$output.= " <font size=\"1\">(".$lang['stealth_mode'].")</font>";
$output.= "</td>";
if($i%2!=0)
$output.= "</tr>";
counter.class.php
Code:
$this->image = "images/" . $this->d->filename . ".jpg";
Code:
header('Content-type: image/jpeg');
$this->im=imagecreatefromjpeg($this->image);
$this->w=imagecolorallocate($this->im, 0, 0, 0);
Code:
imagejpeg($this->im);
flush();
imagedestroy($this->im);
imagetest.php
Code:
header('Content-type: image/jpeg');
$this->image = "images/" . $_GET['filename'] . ".jpg";
$this->im=imagecreatefromjpeg($this->image);
$this->w=imagecolorallocate($this->im, 0, 0, 0);
if($_GET['is_stealth']=='0'){
if (!isset($testNumber))
$testNumber = "123";
imagestring($this->im,3,$_GET['locx'],$_GET['locy'],$testNumber,$this->w);
}
imagejpeg($this->im);
flush();
imagedestroy($this->im);
Any help with this would be appreciated.