Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [Symfony]sfThumbnailPlugin nie działa getFilePath
stirith
post
Post #1





Grupa: Zarejestrowani
Postów: 162
Pomógł: 2
Dołączył: 18.01.2008

Ostrzeżenie: (0%)
-----


W symfony 1.2 nie ma czegoś takiego jak "getFilePath"

No to jak mam pobrać ścieżkę do pliku dla:

Kod
  $thumbnail->loadFile();

cały kod:
Kod
    foreach ($this->getRequest()->getFiles('file') as $fileName) {

  // Create the thumbnail
  $thumbnail = new sfThumbnail(150, 150);
  $thumbnail->loadFile($this->getRequest()->getFilePath('file'));
  $thumbnail->save(sfConfig::get('sf_upload_dir').'/images/'.$fileName, 'image/jpg');

  // Move the uploaded file to the 'uploads' directory
  $this->getRequest()->moveFile('file', sfConfig::get('sf_upload_dir').'/'.$fileName);
}
Go to the top of the page
+Quote Post
Gribo
post
Post #2





Grupa: Zarejestrowani
Postów: 237
Pomógł: 17
Dołączył: 1.11.2007
Skąd: Zielona Góra

Ostrzeżenie: (0%)
-----


Przypuszczam że chcesz zrobić upload zdjęcia więc możesz zrobić to w ten sposób :
  1. $thumbnail = new sfThumbnail(150, 150);
  2. $thumbnail->loadFile($file->getTempName());

mogę sie mylić bo piszę z głowy a dawno tego nie używałem.

aha jesli używasz sf 1.2 to zamiast $this->getRequest() polecam $request-> (IMG:style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post
stirith
post
Post #3





Grupa: Zarejestrowani
Postów: 162
Pomógł: 2
Dołączył: 18.01.2008

Ostrzeżenie: (0%)
-----


Tak tylko że z tego co wyczytałem to w sf 1.2 używa się:

Kod
foreach ($request->getFiles('file') as $fileName) {

}

Co daje w każdej iteracji tablice....a nie obiekt...nie mam możliwości zrobienia czegoś takiego:

Kod
$fileName = $request->getFileName('file');


Więc nie mam też możliwości wywołania funkcji:
Kod
$fileName->getTempName()



Jak w sf 1.2 pobrać obiekt pliku..? a nie tak jak ja pobieram tablice plików...
Go to the top of the page
+Quote Post
Gribo
post
Post #4





Grupa: Zarejestrowani
Postów: 237
Pomógł: 17
Dołączył: 1.11.2007
Skąd: Zielona Góra

Ostrzeżenie: (0%)
-----


mozna np. tak o ile dobrze pamietam
  1. $zdjecie=$this->form->getValue('zdjecie');
  2. $zdjecie->getTempName()


Ten post edytował Gribo 27.10.2009, 16:13:23
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 02:14