fix #728 check if thumbExtractor is supported

remove fileReader its not needed

fix unit tests

fix typo

remove unecessary message
This commit is contained in:
Nicolas Le Goff
2012-06-18 16:11:28 +02:00
parent 44c34b2b75
commit 4edb26c6c6
8 changed files with 318 additions and 298 deletions

View File

@@ -17,6 +17,8 @@ use Doctrine\ORM\EntityManager;
use Entities\LazaretAttribute; use Entities\LazaretAttribute;
use Entities\LazaretFile; use Entities\LazaretFile;
use Entities\LazaretSession; use Entities\LazaretSession;
use MediaAlchemyst\Exception\Exception as MediaAlchemystException;
use MediaAlchemyst\Specification\Image as ImageSpec;
use Monolog\Logger; use Monolog\Logger;
use PHPExiftool\Driver\Metadata\Metadata; use PHPExiftool\Driver\Metadata\Metadata;
use PHPExiftool\Driver\Value\Mono as MonoValue; use PHPExiftool\Driver\Value\Mono as MonoValue;
@@ -398,9 +400,9 @@ class Manager
$this->filesystem->copy($file->getFile()->getRealPath(), $lazaretPathname, true); $this->filesystem->copy($file->getFile()->getRealPath(), $lazaretPathname, true);
$spec = new \MediaAlchemyst\Specification\Image(); $spec = new ImageSpec();
$spec->setResizeMode(\MediaAlchemyst\Specification\Image::RESIZE_MODE_INBOUND_FIXEDRATIO); $spec->setResizeMode(ImageSpec::RESIZE_MODE_INBOUND_FIXEDRATIO);
$spec->setDimensions(375, 275); $spec->setDimensions(375, 275);
$core = \bootstrap::getCore(); $core = \bootstrap::getCore();
@@ -410,7 +412,7 @@ class Manager
->open($file->getFile()->getPathname()) ->open($file->getFile()->getPathname())
->turnInto($lazaretPathname, $spec) ->turnInto($lazaretPathname, $spec)
->close(); ->close();
} catch (\MediaAlchemyst\Exception\Exception $e) { } catch (MediaAlchemystException $e) {
} }

View File

@@ -98,6 +98,7 @@ class Language implements ControllerProviderInterface
$out['errorAjaxRequest'] = _('An error occured, please retry'); $out['errorAjaxRequest'] = _('An error occured, please retry');
$out['fileBeingDownloaded'] = _('Some files are being downloaded'); $out['fileBeingDownloaded'] = _('Some files are being downloaded');
$out['warning'] = _('Attention'); $out['warning'] = _('Attention');
$out['browserFeatureSupport'] = _('This feature is not supported by your browser');
$Serializer = $app['Core']['Serializer']; $Serializer = $app['Core']['Serializer'];

View File

@@ -438,7 +438,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
*/ */
public function get_size() public function get_size()
{ {
return @filesize($this->get_pathfile()); return (int) @filesize($this->get_pathfile());
} }
/** /**

View File

@@ -374,7 +374,8 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){
$(document).ready(function(){
var scope = $("#prod-tool-box"); var scope = $("#prod-tool-box");
var width = 0; var width = 0;
@@ -425,6 +426,9 @@
//thumbExtractor //thumbExtractor
var ThumbEditor = new this.THUMB_EDITOR("thumb_video", "thumb_canvas");
if(ThumbEditor.isSupported()) {
$("#slider-brightness", scope).slider({ $("#slider-brightness", scope).slider({
slide: function() { slide: function() {
$("#value-brightness").val(Math.round($("#slider-brightness").slider("value") / 100 * 300) - 150); $("#value-brightness").val(Math.round($("#slider-brightness").slider("value") / 100 * 300) - 150);
@@ -445,8 +449,6 @@
var sliderWrapper = $("#thumb_wrapper", scope); var sliderWrapper = $("#thumb_wrapper", scope);
var ThumbEditor = new this.THUMB_EDITOR("thumb_video", "thumb_canvas");
$("#thumb_reset_button",scope).bind("click", function(){ $("#thumb_reset_button",scope).bind("click", function(){
var curImg = sliderWrapper.find(".selected"); var curImg = sliderWrapper.find(".selected");
var id = curImg.attr("id").split("_").pop(); var id = curImg.attr("id").split("_").pop();
@@ -649,7 +651,7 @@
} }
else else
{ {
var content = $("<div />").css({'color':'#a00'}).append("{% trans "an error occured" %} " + data.message); //var content = $("<div />").css({'color':'#a00'}).append("{% trans "an error occured" %} " + data.message);
loadingDiv.append(content); loadingDiv.append(content);
enableConfirmButton(dialog); enableConfirmButton(dialog);
} }
@@ -690,5 +692,9 @@
} }
}); });
}); });
}); } else {
//not supported
$("#thumbExtractor").empty().append(language.browserFeatureSupport);
}
});
</script> </script>

View File

@@ -28,6 +28,8 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$app['debug'] = true; $app['debug'] = true;
unset($app['exception_handler']); unset($app['exception_handler']);
$app['Core']['file-system'] = $this->getMock('Symfony\Component\Filesystem\Filesystem', array('remove'));
return $app; return $app;
} }

View File

@@ -276,6 +276,10 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
break; break;
} }
if(null === $statusbit) {
$this->markTestSkipped('No status bit defined in databox');
}
$request = new Request(array("salut" => "salut c'est la fete"), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json')); $request = new Request(array("salut" => "salut c'est la fete"), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
$result = $stub->set_record_status($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id()); $result = $stub->set_record_status($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
$this->assertEquals(400, $result->get_http_code()); $this->assertEquals(400, $result->get_http_code());

View File

@@ -178,6 +178,11 @@
} }
return { return {
isSupported : function () {
var elem = document.createElement('canvas');
return !! elem.getContext && !! elem.getContext('2d');
},
screenshot : function(){ screenshot : function(){
var screenshot = new ScreenShot( var screenshot = new ScreenShot(
store.getLength() + 1, store.getLength() + 1,