@@ -72,12 +72,13 @@ public function __construct(
72
72
*/
73
73
public function execute ()
74
74
{
75
+ $ baseTmpMediaPath = $ this ->mediaConfig ->getBaseTmpMediaPath ();
75
76
try {
76
77
$ remoteFileUrl = $ this ->getRequest ()->getParam ('remote_image ' );
77
- $ originalFileName = $ this -> parseOriginalFileName ($ remoteFileUrl );
78
- $ localFileName = $ this -> localFileName ($ originalFileName );
79
- $ localTmpFileName = $ this -> generateTmpFileName ($ localFileName );
80
- $ localFileMediaPath = $ this -> appendFileSystemPath ($ localTmpFileName );
78
+ $ originalFileName = basename ($ remoteFileUrl );
79
+ $ localFileName = Uploader:: getCorrectFileName ($ originalFileName );
80
+ $ localTmpFileName = Uploader:: getDispretionPath ($ localFileName ) . DIRECTORY_SEPARATOR . $ localFileName ;
81
+ $ localFileMediaPath = $ baseTmpMediaPath . ($ localTmpFileName );
81
82
$ localUniqueFileMediaPath = $ this ->appendNewFileName ($ localFileMediaPath );
82
83
$ this ->retrieveRemoteImage ($ remoteFileUrl , $ localUniqueFileMediaPath );
83
84
$ localFileFullPath = $ this ->appendAbsoluteFileSystemPath ($ localUniqueFileMediaPath );
@@ -101,7 +102,7 @@ public function execute()
101
102
protected function appendResultSaveRemoteImage ($ fileName )
102
103
{
103
104
$ fileInfo = pathinfo ($ fileName );
104
- $ tmpFileName = $ this -> generateTmpFileName ($ fileInfo ['basename ' ]);
105
+ $ tmpFileName = Uploader:: getDispretionPath ($ fileInfo ['basename ' ]) . DIRECTORY_SEPARATOR . $ fileInfo [ ' basename ' ] ;
105
106
$ result ['name ' ] = $ fileInfo ['basename ' ];
106
107
$ result ['type ' ] = $ this ->imageAdapter ->getMimeType ();
107
108
$ result ['error ' ] = 0 ;
@@ -111,16 +112,6 @@ protected function appendResultSaveRemoteImage($fileName)
111
112
return $ result ;
112
113
}
113
114
114
- /**
115
- * @param string $fileName
116
- * @return string
117
- */
118
- protected function localFileName ($ fileName )
119
- {
120
- $ fileName = Uploader::getCorrectFileName ($ fileName );
121
- return $ fileName ;
122
- }
123
-
124
115
/**
125
116
* @param string $fileUrl
126
117
* @param string $localFilePath
@@ -152,43 +143,6 @@ protected function appendNewFileName($localFilePath)
152
143
return $ fileInfo ['dirname ' ] . DIRECTORY_SEPARATOR . $ fileName ;
153
144
}
154
145
155
- /**
156
- * @param string $fileUrl
157
- * @return string
158
- */
159
- protected function parseOriginalFileName ($ fileUrl )
160
- {
161
- return basename ($ fileUrl );
162
- }
163
-
164
- /**
165
- * @param string $fileName
166
- * @return string
167
- */
168
- protected function generateTmpFileName ($ fileName )
169
- {
170
- return Uploader::getDispretionPath ($ fileName ) . DIRECTORY_SEPARATOR . $ fileName ;
171
- }
172
-
173
- /**
174
- * @param string $fileName
175
- * @return string
176
- */
177
- protected function generateFileNameWithPath ($ fileName )
178
- {
179
- return Uploader::getDispretionPath ($ fileName ) . DIRECTORY_SEPARATOR . $ fileName ;
180
- }
181
-
182
- /**
183
- * @param string $localTmpFile
184
- * @return string
185
- */
186
- protected function appendFileSystemPath ($ localTmpFile )
187
- {
188
- $ pathToSave = $ this ->mediaConfig ->getBaseTmpMediaPath ();
189
- return $ pathToSave . $ localTmpFile ;
190
- }
191
-
192
146
/**
193
147
* @param string $localTmpFile
194
148
* @return string
0 commit comments