@@ -68,8 +68,8 @@ |
||
68 | 68 | $quality = 25; |
69 | 69 | $mime = explode( '/', $mimetype ); |
70 | 70 | |
71 | - if( isset( $this->options['image'][ $mime[1] ]['quality'] ) ) { |
|
72 | - $quality = 100 - (int) $this->options['image'][ $mime[1] ]['quality']; |
|
71 | + if( isset( $this->options['image'][$mime[1]]['quality'] ) ) { |
|
72 | + $quality = 100 - (int) $this->options['image'][$mime[1]]['quality']; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | try |
@@ -106,9 +106,12 @@ |
||
106 | 106 | */ |
107 | 107 | public function scan( $path = null ) |
108 | 108 | { |
109 | - try { |
|
109 | + try |
|
110 | + { |
|
110 | 111 | return new \DirectoryIterator( $this->basepath . $path ); |
111 | - } catch( \Exception $e ) { |
|
112 | + } |
|
113 | + catch( \Exception $e ) |
|
114 | + { |
|
112 | 115 | throw new Exception( $e->getMessage(), 0, $e ); |
113 | 116 | } |
114 | 117 | } |
@@ -49,17 +49,17 @@ |
||
49 | 49 | $mime = explode( '/', $mimetype ); |
50 | 50 | |
51 | 51 | $type = ( $mime[0] === 'image' ? 'Image' : 'Application' ); |
52 | - $name = ( isset( $options[ $mime[0] ]['name'] ) ? ucfirst( $options[ $mime[0] ]['name'] ) : 'Standard' ); |
|
52 | + $name = ( isset( $options[$mime[0]]['name'] ) ? ucfirst( $options[$mime[0]]['name'] ) : 'Standard' ); |
|
53 | 53 | |
54 | 54 | |
55 | 55 | if( ctype_alnum( $name ) === false ) |
56 | 56 | { |
57 | - $classname = is_string( $name ) ? '\\Aimeos\\MW\\Media\\' . $name : '<not a string>'; |
|
57 | + $classname = is_string( $name ) ? '\\Aimeos\\MW\\Media\\'.$name : '<not a string>'; |
|
58 | 58 | throw new \Aimeos\MW\Container\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
59 | 59 | } |
60 | 60 | |
61 | 61 | $iface = '\\Aimeos\\MW\\Media\\Iface'; |
62 | - $classname = '\\Aimeos\\MW\\Media\\' . $type . '\\' . $name; |
|
62 | + $classname = '\\Aimeos\\MW\\Media\\'.$type.'\\'.$name; |
|
63 | 63 | |
64 | 64 | if( class_exists( $classname ) === false ) { |
65 | 65 | throw new \Aimeos\MW\Media\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function testConstructGif() |
15 | 15 | { |
16 | 16 | $ds = DIRECTORY_SEPARATOR; |
17 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.gif' ); |
|
17 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.gif' ); |
|
18 | 18 | |
19 | 19 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/gif', array() ); |
20 | 20 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function testConstructJpeg() |
26 | 26 | { |
27 | 27 | $ds = DIRECTORY_SEPARATOR; |
28 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.jpg' ); |
|
28 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.jpg' ); |
|
29 | 29 | |
30 | 30 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/jpeg', array() ); |
31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function testConstructPng() |
37 | 37 | { |
38 | 38 | $ds = DIRECTORY_SEPARATOR; |
39 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.png' ); |
|
39 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.png' ); |
|
40 | 40 | |
41 | 41 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/png', array() ); |
42 | 42 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function testConstructImageException() |
48 | 48 | { |
49 | 49 | $ds = DIRECTORY_SEPARATOR; |
50 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'application.txt' ); |
|
50 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'application.txt' ); |
|
51 | 51 | |
52 | 52 | $this->setExpectedException( '\\Aimeos\\MW\\Media\\Exception' ); |
53 | 53 | new \Aimeos\MW\Media\Image\Imagick( $content, 'text/plain', array() ); |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | public function testSaveGif() |
58 | 58 | { |
59 | 59 | $ds = DIRECTORY_SEPARATOR; |
60 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.png' ); |
|
61 | - $dest = dirname( dirname( dirname( __DIR__ ) ) ) . $ds . 'tmp' . $ds . 'media.gif'; |
|
60 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.png' ); |
|
61 | + $dest = dirname( dirname( dirname( __DIR__ ) ) ).$ds.'tmp'.$ds.'media.gif'; |
|
62 | 62 | |
63 | 63 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/png', array() ); |
64 | 64 | $media->save( $dest, 'image/gif' ); |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | public function testSaveGifInvalidDest() |
72 | 72 | { |
73 | 73 | $ds = DIRECTORY_SEPARATOR; |
74 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.png' ); |
|
75 | - $dest = __DIR__ . $ds . 'notexisting' . $ds . 'media.gif'; |
|
74 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.png' ); |
|
75 | + $dest = __DIR__.$ds.'notexisting'.$ds.'media.gif'; |
|
76 | 76 | |
77 | 77 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/png', array() ); |
78 | 78 | |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | public function testSaveJpeg() |
85 | 85 | { |
86 | 86 | $ds = DIRECTORY_SEPARATOR; |
87 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.png' ); |
|
88 | - $dest = dirname( dirname( dirname( __DIR__ ) ) ) . $ds . 'tmp' . $ds . 'media.jpg'; |
|
87 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.png' ); |
|
88 | + $dest = dirname( dirname( dirname( __DIR__ ) ) ).$ds.'tmp'.$ds.'media.jpg'; |
|
89 | 89 | |
90 | 90 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/gif', array() ); |
91 | 91 | $media->save( $dest, 'image/jpeg' ); |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | public function testSaveJpegInvalidDest() |
99 | 99 | { |
100 | 100 | $ds = DIRECTORY_SEPARATOR; |
101 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.png' ); |
|
102 | - $dest = __DIR__ . $ds . 'notexisting' . $ds . 'media.jpg'; |
|
101 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.png' ); |
|
102 | + $dest = __DIR__.$ds.'notexisting'.$ds.'media.jpg'; |
|
103 | 103 | |
104 | 104 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/png', array() ); |
105 | 105 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | public function testSavePng() |
112 | 112 | { |
113 | 113 | $ds = DIRECTORY_SEPARATOR; |
114 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.gif' ); |
|
115 | - $dest = dirname( dirname( dirname( __DIR__ ) ) ) . $ds . 'tmp' . $ds . 'media.png'; |
|
114 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.gif' ); |
|
115 | + $dest = dirname( dirname( dirname( __DIR__ ) ) ).$ds.'tmp'.$ds.'media.png'; |
|
116 | 116 | |
117 | 117 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/gif', array() ); |
118 | 118 | $media->save( $dest, 'image/png' ); |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | public function testSavePngInvalidDest() |
126 | 126 | { |
127 | 127 | $ds = DIRECTORY_SEPARATOR; |
128 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.gif' ); |
|
129 | - $dest = __DIR__ . $ds . 'notexisting' . $ds . 'media.png'; |
|
128 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.gif' ); |
|
129 | + $dest = __DIR__.$ds.'notexisting'.$ds.'media.png'; |
|
130 | 130 | |
131 | 131 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/gif', array() ); |
132 | 132 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | public function testScale() |
139 | 139 | { |
140 | 140 | $ds = DIRECTORY_SEPARATOR; |
141 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.png' ); |
|
141 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.png' ); |
|
142 | 142 | |
143 | 143 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/png', array() ); |
144 | 144 | $info = getimagesizefromstring( $media->scale( 100, 100, false )->save( null, 'image/png' ) ); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | public function testScaleFit() |
152 | 152 | { |
153 | 153 | $ds = DIRECTORY_SEPARATOR; |
154 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.png' ); |
|
154 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.png' ); |
|
155 | 155 | |
156 | 156 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/png', array() ); |
157 | 157 | $info = getimagesizefromstring( $media->scale( 5, 100 )->save( null, 'image/png' ) ); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | public function testScaleFitInside() |
165 | 165 | { |
166 | 166 | $ds = DIRECTORY_SEPARATOR; |
167 | - $content = file_get_contents( dirname( __DIR__ ) . $ds . '_testfiles' . $ds . 'image.png' ); |
|
167 | + $content = file_get_contents( dirname( __DIR__ ).$ds.'_testfiles'.$ds.'image.png' ); |
|
168 | 168 | |
169 | 169 | $media = new \Aimeos\MW\Media\Image\Imagick( $content, 'image/png', array() ); |
170 | 170 | $info = getimagesizefromstring( $media->scale( 100, 100 )->save( null, 'image/png' ) ); |