2009-05-24 14:16:17 +02:00
|
|
|
<?php
|
2010-12-20 03:19:17 +01:00
|
|
|
|
2016-10-14 03:30:05 +02:00
|
|
|
namespace SilverStripe\ORM\Tests;
|
|
|
|
|
2016-08-19 00:51:35 +02:00
|
|
|
use SilverStripe\Assets\File;
|
|
|
|
use SilverStripe\Assets\Filesystem as SSFilesystem;
|
2016-11-13 08:35:43 +01:00
|
|
|
use SilverStripe\Assets\Folder;
|
2016-08-19 00:51:35 +02:00
|
|
|
use SilverStripe\Assets\Image;
|
2016-10-14 03:30:05 +02:00
|
|
|
use SilverStripe\Assets\Storage\DBFile;
|
2016-08-19 00:51:35 +02:00
|
|
|
use SilverStripe\Core\Config\Config;
|
|
|
|
use SilverStripe\Core\Convert;
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
|
|
use SilverStripe\View\Parsers\ShortcodeParser;
|
2016-10-14 03:30:05 +02:00
|
|
|
use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore;
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2009-05-24 14:16:17 +02:00
|
|
|
class ImageTest extends SapphireTest {
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 19:48:54 +01:00
|
|
|
protected static $fixture_file = 'ImageTest.yml';
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function setUp() {
|
2010-12-20 03:19:17 +01:00
|
|
|
parent::setUp();
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2015-07-16 12:12:15 +02:00
|
|
|
// Execute specific subclass
|
|
|
|
if(get_class($this) == "ImageTest") {
|
|
|
|
$this->markTestSkipped(sprintf('Skipping %s ', get_class($this)));
|
2012-10-25 00:28:39 +02:00
|
|
|
return;
|
2010-12-20 03:19:17 +01:00
|
|
|
}
|
2015-06-10 01:16:11 +02:00
|
|
|
|
2015-09-15 04:52:02 +02:00
|
|
|
// Set backend root to /ImageTest
|
2016-10-14 03:30:05 +02:00
|
|
|
TestAssetStore::activate('ImageTest');
|
2015-09-15 04:52:02 +02:00
|
|
|
|
2015-06-10 01:16:11 +02:00
|
|
|
// Copy test images for each of the fixture references
|
2016-10-14 03:30:05 +02:00
|
|
|
$files = File::get()->exclude('ClassName', Folder::class);
|
2015-09-15 04:52:02 +02:00
|
|
|
foreach($files as $image) {
|
2016-10-14 03:30:05 +02:00
|
|
|
$filePath = TestAssetStore::getLocalPath($image); // Only correct for test asset store
|
2016-11-13 08:35:43 +01:00
|
|
|
$sourcePath = __DIR__ . '/ImageTest/' . $image->Name;
|
2015-06-10 01:16:11 +02:00
|
|
|
if(!file_exists($filePath)) {
|
2016-08-19 00:51:35 +02:00
|
|
|
SSFilesystem::makeFolder(dirname($filePath));
|
2015-09-15 04:52:02 +02:00
|
|
|
if (!copy($sourcePath, $filePath)) {
|
|
|
|
user_error('Failed to copy test images', E_USER_ERROR);
|
|
|
|
}
|
2015-06-10 01:16:11 +02:00
|
|
|
}
|
|
|
|
}
|
2012-10-25 00:28:39 +02:00
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-10-25 00:28:39 +02:00
|
|
|
public function tearDown() {
|
2016-10-14 03:30:05 +02:00
|
|
|
TestAssetStore::reset();
|
2012-10-25 00:28:39 +02:00
|
|
|
parent::tearDown();
|
2010-12-20 03:19:17 +01:00
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testGetTagWithTitle() {
|
2016-10-14 03:30:05 +02:00
|
|
|
Config::inst()->update(DBFile::class, 'force_resample', false);
|
2016-03-08 21:50:18 +01:00
|
|
|
|
2016-10-14 03:30:05 +02:00
|
|
|
$image = $this->objFromFixture(Image::class, 'imageWithTitle');
|
2015-09-15 04:52:02 +02:00
|
|
|
$expected = '<img src="/assets/ImageTest/folder/444065542b/test-image.png" alt="This is a image Title" />';
|
|
|
|
$actual = trim($image->getTag());
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2009-05-24 14:16:17 +02:00
|
|
|
$this->assertEquals($expected, $actual);
|
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testGetTagWithoutTitle() {
|
2016-10-14 03:30:05 +02:00
|
|
|
Config::inst()->update(DBFile::class, 'force_resample', false);
|
2016-03-08 21:50:18 +01:00
|
|
|
|
2016-10-14 03:30:05 +02:00
|
|
|
$image = $this->objFromFixture(Image::class, 'imageWithoutTitle');
|
2015-09-15 04:52:02 +02:00
|
|
|
$expected = '<img src="/assets/ImageTest/folder/444065542b/test-image.png" alt="test image" />';
|
|
|
|
$actual = trim($image->getTag());
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2009-05-24 14:16:17 +02:00
|
|
|
$this->assertEquals($expected, $actual);
|
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testGetTagWithoutTitleContainingDots() {
|
2016-10-14 03:30:05 +02:00
|
|
|
Config::inst()->update(DBFile::class, 'force_resample', false);
|
2016-03-08 21:50:18 +01:00
|
|
|
|
2016-10-14 03:30:05 +02:00
|
|
|
$image = $this->objFromFixture(Image::class, 'imageWithoutTitleContainingDots');
|
2015-09-15 04:52:02 +02:00
|
|
|
$expected = '<img src="/assets/ImageTest/folder/46affab704/test.image.with.dots.png" alt="test.image.with.dots" />';
|
|
|
|
$actual = trim($image->getTag());
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2009-05-24 14:16:17 +02:00
|
|
|
$this->assertEquals($expected, $actual);
|
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 00:15:28 +01:00
|
|
|
/**
|
|
|
|
* Tests that multiple image manipulations may be performed on a single Image
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testMultipleGenerateManipulationCalls() {
|
2016-10-14 03:30:05 +02:00
|
|
|
$image = $this->objFromFixture(Image::class, 'imageWithoutTitle');
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2015-06-13 01:42:51 +02:00
|
|
|
$imageFirst = $image->ScaleWidth(200);
|
2010-12-20 03:19:17 +01:00
|
|
|
$this->assertNotNull($imageFirst);
|
|
|
|
$expected = 200;
|
|
|
|
$actual = $imageFirst->getWidth();
|
|
|
|
|
|
|
|
$this->assertEquals($expected, $actual);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2015-09-15 04:52:02 +02:00
|
|
|
$imageSecond = $imageFirst->ScaleHeight(100);
|
2010-12-20 03:19:17 +01:00
|
|
|
$this->assertNotNull($imageSecond);
|
|
|
|
$expected = 100;
|
|
|
|
$actual = $imageSecond->getHeight();
|
|
|
|
$this->assertEquals($expected, $actual);
|
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 00:15:28 +01:00
|
|
|
/**
|
|
|
|
* Tests that image manipulations that do not affect the resulting dimensions
|
|
|
|
* of the output image do not resample the file.
|
|
|
|
*/
|
|
|
|
public function testReluctanceToResampling() {
|
2016-10-14 03:30:05 +02:00
|
|
|
$image = $this->objFromFixture(Image::class, 'imageWithoutTitle');
|
2013-03-21 00:15:28 +01:00
|
|
|
$this->assertTrue($image->isSize(300, 300));
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2014-06-28 05:20:28 +02:00
|
|
|
// Set width to 300 pixels
|
2015-06-13 01:42:51 +02:00
|
|
|
$imageScaleWidth = $image->ScaleWidth(300);
|
|
|
|
$this->assertEquals($imageScaleWidth->getWidth(), 300);
|
|
|
|
$this->assertEquals($image->Filename, $imageScaleWidth->Filename);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 00:15:28 +01:00
|
|
|
// Set height to 300 pixels
|
2015-06-13 01:42:51 +02:00
|
|
|
$imageScaleHeight = $image->ScaleHeight(300);
|
|
|
|
$this->assertEquals($imageScaleHeight->getHeight(), 300);
|
|
|
|
$this->assertEquals($image->Filename, $imageScaleHeight->Filename);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 00:15:28 +01:00
|
|
|
// Crop image to 300 x 300
|
2015-06-13 01:42:51 +02:00
|
|
|
$imageCropped = $image->Fill(300, 300);
|
2013-03-21 00:15:28 +01:00
|
|
|
$this->assertTrue($imageCropped->isSize(300, 300));
|
|
|
|
$this->assertEquals($image->Filename, $imageCropped->Filename);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 00:15:28 +01:00
|
|
|
// Resize (padded) to 300 x 300
|
2015-06-13 01:42:51 +02:00
|
|
|
$imageSized = $image->Pad(300, 300);
|
2013-03-21 00:15:28 +01:00
|
|
|
$this->assertTrue($imageSized->isSize(300, 300));
|
|
|
|
$this->assertEquals($image->Filename, $imageSized->Filename);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 00:15:28 +01:00
|
|
|
// Padded image 300 x 300 (same as above)
|
2015-06-13 01:42:51 +02:00
|
|
|
$imagePadded = $image->Pad(300, 300);
|
2013-03-21 00:15:28 +01:00
|
|
|
$this->assertTrue($imagePadded->isSize(300, 300));
|
|
|
|
$this->assertEquals($image->Filename, $imagePadded->Filename);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 00:15:28 +01:00
|
|
|
// Resized (stretched) to 300 x 300
|
|
|
|
$imageStretched = $image->ResizedImage(300, 300);
|
|
|
|
$this->assertTrue($imageStretched->isSize(300, 300));
|
|
|
|
$this->assertEquals($image->Filename, $imageStretched->Filename);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2015-06-13 01:42:51 +02:00
|
|
|
// Fit (various options)
|
|
|
|
$imageFit = $image->Fit(300, 600);
|
|
|
|
$this->assertTrue($imageFit->isSize(300, 300));
|
|
|
|
$this->assertEquals($image->Filename, $imageFit->Filename);
|
|
|
|
$imageFit = $image->Fit(600, 300);
|
|
|
|
$this->assertTrue($imageFit->isSize(300, 300));
|
|
|
|
$this->assertEquals($image->Filename, $imageFit->Filename);
|
|
|
|
$imageFit = $image->Fit(300, 300);
|
|
|
|
$this->assertTrue($imageFit->isSize(300, 300));
|
|
|
|
$this->assertEquals($image->Filename, $imageFit->Filename);
|
2013-03-21 00:15:28 +01:00
|
|
|
}
|
2014-06-28 05:20:28 +02:00
|
|
|
|
|
|
|
/**
|
2016-03-08 21:50:18 +01:00
|
|
|
* Tests that a URL to a resampled image is provided when force_resample is
|
2015-07-16 21:03:52 +02:00
|
|
|
* set to true, if the resampled file is smaller than the original.
|
2014-06-28 05:20:28 +02:00
|
|
|
*/
|
|
|
|
public function testForceResample() {
|
2016-10-14 03:30:05 +02:00
|
|
|
$imageHQ = $this->objFromFixture(Image::class, 'highQualityJPEG');
|
2015-07-16 21:03:52 +02:00
|
|
|
$imageHQR = $imageHQ->Resampled();
|
2016-10-14 03:30:05 +02:00
|
|
|
$imageLQ = $this->objFromFixture(Image::class, 'lowQualityJPEG');
|
2015-07-16 21:03:52 +02:00
|
|
|
$imageLQR = $imageLQ->Resampled();
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2015-07-16 21:03:52 +02:00
|
|
|
// Test resampled file is served when force_resample = true
|
2016-10-14 03:30:05 +02:00
|
|
|
Config::inst()->update(DBFile::class, 'force_resample', true);
|
2015-07-16 21:03:52 +02:00
|
|
|
$this->assertLessThan($imageHQ->getAbsoluteSize(), $imageHQR->getAbsoluteSize(), 'Resampled image is smaller than original');
|
|
|
|
$this->assertEquals($imageHQ->getURL(), $imageHQR->getSourceURL(), 'Path to a resampled image was returned by getURL()');
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2015-07-16 21:03:52 +02:00
|
|
|
// Test original file is served when force_resample = true but original file is low quality
|
|
|
|
$this->assertGreaterThanOrEqual($imageLQ->getAbsoluteSize(), $imageLQR->getAbsoluteSize(), 'Resampled image is larger or same size as original');
|
|
|
|
$this->assertNotEquals($imageLQ->getURL(), $imageLQR->getSourceURL(), 'Path to the original image file was returned by getURL()');
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2015-07-16 21:03:52 +02:00
|
|
|
// Test original file is served when force_resample = false
|
2016-10-14 03:30:05 +02:00
|
|
|
Config::inst()->update(DBFile::class, 'force_resample', false);
|
2015-07-16 21:03:52 +02:00
|
|
|
$this->assertNotEquals($imageHQ->getURL(), $imageHQR->getSourceURL(), 'Path to the original image file was returned by getURL()');
|
2014-06-28 05:20:28 +02:00
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 00:15:28 +01:00
|
|
|
public function testImageResize() {
|
2016-10-14 03:30:05 +02:00
|
|
|
$image = $this->objFromFixture(Image::class, 'imageWithoutTitle');
|
2013-03-21 00:15:28 +01:00
|
|
|
$this->assertTrue($image->isSize(300, 300));
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 00:15:28 +01:00
|
|
|
// Test normal resize
|
2015-06-13 01:42:51 +02:00
|
|
|
$resized = $image->Pad(150, 100);
|
2013-03-21 00:15:28 +01:00
|
|
|
$this->assertTrue($resized->isSize(150, 100));
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 00:15:28 +01:00
|
|
|
// Test cropped resize
|
2015-06-13 01:42:51 +02:00
|
|
|
$cropped = $image->Fill(100, 200);
|
2013-03-21 00:15:28 +01:00
|
|
|
$this->assertTrue($cropped->isSize(100, 200));
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-03-21 00:15:28 +01:00
|
|
|
// Test padded resize
|
2015-06-13 01:42:51 +02:00
|
|
|
$padded = $image->Pad(200, 100);
|
2013-03-21 00:15:28 +01:00
|
|
|
$this->assertTrue($padded->isSize(200, 100));
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2015-06-13 01:42:51 +02:00
|
|
|
// Test Fit
|
|
|
|
$ratio = $image->Fit(80, 160);
|
2013-03-21 00:15:28 +01:00
|
|
|
$this->assertTrue($ratio->isSize(80, 80));
|
2015-06-13 01:42:51 +02:00
|
|
|
|
|
|
|
// Test FitMax
|
|
|
|
$fitMaxDn = $image->FitMax(200, 100);
|
|
|
|
$this->assertTrue($fitMaxDn->isSize(100, 100));
|
|
|
|
$fitMaxUp = $image->FitMax(500, 400);
|
|
|
|
$this->assertTrue($fitMaxUp->isSize(300, 300));
|
2016-03-08 21:50:18 +01:00
|
|
|
|
2015-06-13 01:42:51 +02:00
|
|
|
//Test ScaleMax
|
|
|
|
$scaleMaxWDn = $image->ScaleMaxWidth(200);
|
|
|
|
$this->assertTrue($scaleMaxWDn->isSize(200, 200));
|
|
|
|
$scaleMaxWUp = $image->ScaleMaxWidth(400);
|
|
|
|
$this->assertTrue($scaleMaxWUp->isSize(300, 300));
|
|
|
|
$scaleMaxHDn = $image->ScaleMaxHeight(200);
|
|
|
|
$this->assertTrue($scaleMaxHDn->isSize(200, 200));
|
|
|
|
$scaleMaxHUp = $image->ScaleMaxHeight(400);
|
|
|
|
$this->assertTrue($scaleMaxHUp->isSize(300, 300));
|
|
|
|
|
|
|
|
// Test FillMax
|
|
|
|
$cropMaxDn = $image->FillMax(200, 100);
|
|
|
|
$this->assertTrue($cropMaxDn->isSize(200, 100));
|
|
|
|
$cropMaxUp = $image->FillMax(400, 200);
|
|
|
|
$this->assertTrue($cropMaxUp->isSize(300, 150));
|
2016-03-08 21:50:18 +01:00
|
|
|
|
2015-06-13 01:42:51 +02:00
|
|
|
// Test Clip
|
|
|
|
$clipWDn = $image->CropWidth(200);
|
|
|
|
$this->assertTrue($clipWDn->isSize(200, 300));
|
|
|
|
$clipWUp = $image->CropWidth(400);
|
|
|
|
$this->assertTrue($clipWUp->isSize(300, 300));
|
|
|
|
$clipHDn = $image->CropHeight(200);
|
|
|
|
$this->assertTrue($clipHDn->isSize(300, 200));
|
|
|
|
$clipHUp = $image->CropHeight(400);
|
|
|
|
$this->assertTrue($clipHUp->isSize(300, 300));
|
2013-03-21 00:15:28 +01:00
|
|
|
}
|
2013-04-15 12:17:00 +02:00
|
|
|
|
|
|
|
/**
|
2014-11-18 23:05:07 +01:00
|
|
|
* @expectedException InvalidArgumentException
|
2013-04-15 12:17:00 +02:00
|
|
|
*/
|
|
|
|
public function testGenerateImageWithInvalidParameters() {
|
2016-10-14 03:30:05 +02:00
|
|
|
$image = $this->objFromFixture(Image::class, 'imageWithoutTitle');
|
2015-09-15 04:52:02 +02:00
|
|
|
$image->ScaleHeight('String');
|
2015-06-13 01:42:51 +02:00
|
|
|
$image->Pad(600,600,'XXXXXX');
|
2013-04-15 12:17:00 +02:00
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-04-15 12:17:00 +02:00
|
|
|
public function testCacheFilename() {
|
2016-10-14 03:30:05 +02:00
|
|
|
$image = $this->objFromFixture(Image::class, 'imageWithoutTitle');
|
2015-06-13 01:42:51 +02:00
|
|
|
$imageFirst = $image->Pad(200,200,'CCCCCC');
|
2015-09-15 04:52:02 +02:00
|
|
|
$imageFilename = $imageFirst->getURL();
|
2013-04-15 12:17:00 +02:00
|
|
|
// Encoding of the arguments is duplicated from cacheFilename
|
2015-07-28 03:54:49 +02:00
|
|
|
$neededPart = 'Pad' . Convert::base64url_encode(array(200,200,'CCCCCC'));
|
2013-04-15 12:17:00 +02:00
|
|
|
$this->assertContains($neededPart, $imageFilename, 'Filename for cached image is correctly generated');
|
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2015-09-02 19:38:02 +02:00
|
|
|
/**
|
2016-03-08 21:50:18 +01:00
|
|
|
* Test that propertes from the source Image are inherited by resampled images
|
2015-09-02 19:38:02 +02:00
|
|
|
*/
|
|
|
|
public function testPropertyInheritance() {
|
|
|
|
$testString = 'This is a test';
|
2016-10-14 03:30:05 +02:00
|
|
|
$origImage = $this->objFromFixture(Image::class, 'imageWithTitle');
|
2015-09-02 19:38:02 +02:00
|
|
|
$origImage->TestProperty = $testString;
|
|
|
|
$resampled = $origImage->ScaleWidth(10);
|
|
|
|
$this->assertEquals($resampled->TestProperty, $testString);
|
|
|
|
$resampled2 = $resampled->ScaleWidth(5);
|
|
|
|
$this->assertEquals($resampled2->TestProperty, $testString);
|
|
|
|
}
|
2016-03-08 12:20:51 +01:00
|
|
|
|
|
|
|
public function testShortcodeHandlerFallsBackToFileProperties() {
|
2016-10-14 03:30:05 +02:00
|
|
|
$image = $this->objFromFixture(Image::class, 'imageWithTitle');
|
2016-03-08 12:20:51 +01:00
|
|
|
$parser = new ShortcodeParser();
|
2016-10-14 03:30:05 +02:00
|
|
|
$parser->register('image', array(Image::class, 'handle_shortcode'));
|
2016-03-08 12:20:51 +01:00
|
|
|
|
|
|
|
$this->assertEquals(
|
|
|
|
sprintf(
|
|
|
|
'<img src="%s" alt="%s">',
|
|
|
|
$image->Link(),
|
|
|
|
$image->Title
|
|
|
|
),
|
|
|
|
$parser->parse(sprintf('[image id=%d]', $image->ID))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testShortcodeHandlerUsesShortcodeProperties() {
|
2016-10-14 03:30:05 +02:00
|
|
|
$image = $this->objFromFixture(Image::class, 'imageWithTitle');
|
2016-03-08 12:20:51 +01:00
|
|
|
$parser = new ShortcodeParser();
|
2016-10-14 03:30:05 +02:00
|
|
|
$parser->register('image', array(Image::class, 'handle_shortcode'));
|
2016-03-08 12:20:51 +01:00
|
|
|
|
|
|
|
$this->assertEquals(
|
|
|
|
sprintf(
|
|
|
|
'<img src="%s" alt="Alt content" title="Title content">',
|
|
|
|
$image->Link()
|
|
|
|
),
|
|
|
|
$parser->parse(sprintf(
|
|
|
|
'[image id="%d" alt="Alt content" title="Title content"]',
|
|
|
|
$image->ID
|
|
|
|
))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testShortcodeHandlerAddsDefaultAttributes() {
|
2016-10-14 03:30:05 +02:00
|
|
|
$image = $this->objFromFixture(Image::class, 'imageWithoutTitle');
|
2016-03-08 12:20:51 +01:00
|
|
|
$parser = new ShortcodeParser();
|
2016-10-14 03:30:05 +02:00
|
|
|
$parser->register('image', array(Image::class, 'handle_shortcode'));
|
2016-03-08 12:20:51 +01:00
|
|
|
|
|
|
|
$this->assertEquals(
|
|
|
|
sprintf(
|
|
|
|
'<img src="%s" alt="%s">',
|
|
|
|
$image->Link(),
|
|
|
|
$image->Title
|
|
|
|
),
|
|
|
|
$parser->parse(sprintf(
|
|
|
|
'[image id="%d"]',
|
|
|
|
$image->ID
|
|
|
|
))
|
|
|
|
);
|
|
|
|
}
|
2012-03-24 04:04:52 +01:00
|
|
|
}
|