Skip to content

Commit

Permalink
Merge pull request #43 from ivan1986/gaufrette_support
Browse files Browse the repository at this point in the history
support gaufrette in image type
  • Loading branch information
DavidBadura committed Jul 22, 2013
2 parents f4159ce + 97e5dfe commit c8cbafd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Form/Type/ImageType.php
Expand Up @@ -56,9 +56,13 @@ public function buildView(FormView $view, FormInterface $form, array $options)
}
$data = $form->getData();

if ($data && (strpos(realpath($data->getPath()), realpath($options['base_path'])) === 0)) {
if ($data) {
/* @var $data SplFileInfo */
$uri = str_replace(realpath($options['base_path']), $options['base_uri'], $data->getRealPath());
if (strpos(realpath($data->getPath()), realpath($options['base_path'])) === 0) {
$uri = str_replace(realpath($options['base_path']), $options['base_uri'], $data->getRealPath());
} else {
$uri = str_replace($options['base_path'], $options['base_uri'], $data->getPathname());
}
if ('/' !== DIRECTORY_SEPARATOR) {
$uri = str_replace(DIRECTORY_SEPARATOR, '/', $uri);
}
Expand Down

0 comments on commit c8cbafd

Please sign in to comment.