How to show images?

Cristina
2010-05-05
2013-04-17
  • Cristina

    Cristina - 2010-05-05

    I've been looking and adapting the library I it's really usefull, thanks.
    But I've a problem: I can not see the images. It's really strange because it loads the css and both are call with relatives url.
    Coul somebody tell me what I'm doing wrong? Is somebody using this library and can gives me a tip?
    Thanks,
    Cristin

     
  • Abnoba12

    Abnoba12 - 2010-05-05

    Could you give me some more context? Are you building an epub and not seeing images in an epub reader, or are you reading an epub and dumping the content out to the web? The code you are having trouble with would help me help you a lot more.

     
  • Cristina

    Cristina - 2010-05-10

    First of all: thanks for answering so fast! (I hadn't seen it before)

    I'm trying to show the epub contents in a website using this library.
    I'm working with symfony and have integrated the classes without problems. I can see all the html' contents but I not the images. I've been trying to follow the code and it finds the resources but does not display it on the template…

    Could you tell me something to help me? Should I add something?

    Thank you very much again.

    Cristina

     
  • Cristina

    Cristina - 2010-05-17

    I've been trying to solve it but there is no way… I don't know what thinks i could try.
    Is somebody reading the epub content and displaying the images?
    I'd really appreciate your help.
    thanks,
    cris

     
  • Cristina

    Cristina - 2010-05-19

    Well, at the end I could fix it. I tell the solution because perhaps I can help somebody else.
    I'm working with symfony, so I'd tell you the solution for this framework.

    I make a ajax call in my template for all the images in order to put the real image in the src:

    <?php   
        $seccioo = html_entity_decode($seccio);
        preg_match_all('/<img[^>]+>/i', $seccioo, $result); 
        foreach($result[0] as $img_tag){
            preg_match('/src=("[^"]*")/i',$img_tag, $src);
            $ruta = str_replace('"','',$src[1]);   $ruta = str_replace('"','',$ruta);  
            $seccio = str_replace($ruta, url_for('ebooks/imatgeEbook?nom='.$ruta), $seccio);
        }
        echo html_entity_decode($seccio);
        ?>
    

    and I get the content in my action with the function "getContentFile()":

    public function executeImatgeEbook(sfWebRequest $request){
        $nom = $request->getParameter("nom");    
        sfContext::getInstance()->getResponse()->setContent('image/jpeg');
        $this->getResponse()->setHttpHeader('Content-type', 'image/jpeg');  
        $ebook = $_SESSION['ebook'];    
        echo imagejpeg(imagecreatefromstring($ebook->getContentFile($nom)));
        imagedestroy($img);
        return sfView::NONE;
      }
    

    Hope it helps!
    Cristina

     
  • Mani Nguyen

    Mani Nguyen - 2012-10-04

    Hi Cristina,

    i will show the content of the epub into a website too, but I don't know how to show up the images?
    The sample code also doesn't show any images?! Could you explain me why?

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks