Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image can't be initialized #97

Open
eesnaola opened this issue Sep 29, 2015 · 2 comments
Open

Image can't be initialized #97

eesnaola opened this issue Sep 29, 2015 · 2 comments

Comments

@eesnaola
Copy link

Hello,

I am experiencing some problems when using the images with Twig . In fact, when I try to upload pictures from the server I'm always getting an "Image "/../../../logo.png" can not be initialized."

My code looks like this:

<!DOCTYPE pdf SYSTEM "%resources%/dtd/doctype.dtd">
 <pdf>
  <dynamic-page >
    <img src="{{pdf_image('HomeBundle:Resources/public/images/logo.png')}}"/>
  </dynamic-page >
</pdf>

the controller:

public function caratulaAction($name)
 {
  $facade = $this->get('ps_pdf.facade');
  $response = new Response();
  $this->render('HomeBundle:Default:caratula.pdf.twig', array("name" => $name), $response);
  $xml = $response->getContent();
  $content = $facade->render($xml);
  return new Response($content, 200, array('content-type' => 'application/pdf'));
}

and the routing:

caratula:
    path:     /caratula/{name}.{_format}
    defaults: { _controller: HomeBundle:Default:caratula, _format: html}
    requirements:
        _format: html|pdf

Sorry for my bad English.

@eesnaola
Copy link
Author

eesnaola commented Oct 5, 2015

Try with multiple images and all the same error.

@garak
Copy link

garak commented Mar 8, 2017

I had the same problem, I solved by using a smaller image.
I found that images with height > 1000 are causing error (it's just an empiric value, YMMV)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants