* fix the problem with old images that don't have a numeric name
This commit is contained in:
committed by
Jeremy Newman
parent
db2a960dd5
commit
6fa71d05a5
@@ -20,6 +20,7 @@ class Screenshot {
|
|||||||
var $iVersionId;
|
var $iVersionId;
|
||||||
var $iAppId;
|
var $iAppId;
|
||||||
var $sDirectory;
|
var $sDirectory;
|
||||||
|
var $sUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor, fetches the description and creates the Image objects and files if needed.
|
* constructor, fetches the description and creates the Image objects and files if needed.
|
||||||
@@ -54,6 +55,7 @@ class Screenshot {
|
|||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
$this->iAppId = $oRow->appId;
|
$this->iAppId = $oRow->appId;
|
||||||
$this->iVersionId = $oRow->versionId;
|
$this->iVersionId = $oRow->versionId;
|
||||||
|
$this->sUrl = $oRow->url;
|
||||||
}
|
}
|
||||||
} else // we are working on a non-existing screenshot
|
} else // we are working on a non-existing screenshot
|
||||||
{
|
{
|
||||||
@@ -76,6 +78,7 @@ class Screenshot {
|
|||||||
return false;
|
return false;
|
||||||
} else // we managed to copy the file, now we have to process the image
|
} else // we managed to copy the file, now we have to process the image
|
||||||
{
|
{
|
||||||
|
$this->sUrl = $this->iScreenshotId;
|
||||||
$this->generate();
|
$this->generate();
|
||||||
// we have to update the entry now that we know its name
|
// we have to update the entry now that we know its name
|
||||||
$sQuery = "UPDATE ".$this->sTable." SET url = '".$this->iScreenshotId."' WHERE ".$this->sTableId." = '".$this->iScreenshotId."'";
|
$sQuery = "UPDATE ".$this->sTable." SET url = '".$this->iScreenshotId."' WHERE ".$this->sTableId." = '".$this->iScreenshotId."'";
|
||||||
@@ -127,20 +130,20 @@ class Screenshot {
|
|||||||
{
|
{
|
||||||
// first we will create the thumbnail
|
// first we will create the thumbnail
|
||||||
// load the screenshot
|
// load the screenshot
|
||||||
$this->oThumbnailImage = new Image("/data/".$this->sDirectory."/originals/".$this->iScreenshotId);
|
$this->oThumbnailImage = new Image("/data/".$this->sDirectory."/originals/".$this->sUrl);
|
||||||
$this->oThumbnailImage->make_thumb(0,0,1,'#000000');
|
$this->oThumbnailImage->make_thumb(0,0,1,'#000000');
|
||||||
// store the image
|
// store the image
|
||||||
$this->oThumbnailImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/".$this->sDirectory."/thumbnails/".$this->iScreenshotId);
|
$this->oThumbnailImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/".$this->sDirectory."/thumbnails/".$this->sUrl);
|
||||||
|
|
||||||
// now we'll process the screenshot image for watermarking
|
// now we'll process the screenshot image for watermarking
|
||||||
// load the screenshot
|
// load the screenshot
|
||||||
$this->oScreenshotImage = new Image("/data/".$this->sDirectory."/originals/".$this->iScreenshotId);
|
$this->oScreenshotImage = new Image("/data/".$this->sDirectory."/originals/".$this->sUrl);
|
||||||
// resize the image
|
// resize the image
|
||||||
$this->oScreenshotImage->make_full();
|
$this->oScreenshotImage->make_full();
|
||||||
// store the resized image
|
// store the resized image
|
||||||
$this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/".$this->sDirectory."/".$this->iScreenshotId);
|
$this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/".$this->sDirectory."/".$this->sUrl);
|
||||||
// reload the resized screenshot
|
// reload the resized screenshot
|
||||||
$this->oScreenshotImage = new Image("/data/".$this->sDirectory."/".$this->iScreenshotId);
|
$this->oScreenshotImage = new Image("/data/".$this->sDirectory."/".$this->sUrl);
|
||||||
// load the watermark
|
// load the watermark
|
||||||
$watermark = new image("/images/watermark.png");
|
$watermark = new image("/images/watermark.png");
|
||||||
// add the watermark to the screenshot
|
// add the watermark to the screenshot
|
||||||
@@ -148,7 +151,7 @@ class Screenshot {
|
|||||||
// clean up the memory
|
// clean up the memory
|
||||||
$watermark->destroy();
|
$watermark->destroy();
|
||||||
// store the watermarked image
|
// store the watermarked image
|
||||||
$this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/".$this->sDirectory."/".$this->iScreenshotId);
|
$this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/".$this->sDirectory."/".$this->sUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user