Page 1 of 1

Zend framework: problem with displaying images

Posted: Wed Aug 22, 2007 6:21 am
by nahydy
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hi 
i'm new in zend framework. i followed the example in this link 

[url]http://g-rossolini.developpez.com/tutoriels/php/zend-framework/debuter/[/url]

my problem is when i tryed  to display an image nothing is diplayed in my page. this my code:

Code: Select all

<html>
<head>
<title><?php echo $this->escape($this->title); ?></title>
</head>
<body>
<h1><?php echo $this->escape($this->title); ?></h1>

saluit
<img src="./public/images/tick.png">



</body>
</html>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Aug 22, 2007 6:25 am
by CoderGoblin
A lot depends on any .htaccess file you have in your top level. Are .png excluded from being changed to index.php ?
Try removing the './' in front of the path. do you have a .htaccess in the public area to remove redirection (contents = RewriteEngine off) ?

Posted: Wed Aug 22, 2007 6:26 am
by jmut
can you paste your .htaccess rule.

Is there such image really on server.

Posted: Wed Aug 22, 2007 6:32 am
by nahydy
i tried to remove the ./ but it still the same problem. this my .htaccess:

Code: Select all

RewriteEngine on
RewriteRule !\.(js|css|ico|gif|jpg|png)$ index.php
php_flag magic_quotes_gpc off
php_flag register_globals off

Posted: Wed Aug 22, 2007 6:36 am
by nahydy
i tried this code in .htaccess

Code: Select all

RewriteEngine on
RewriteRule .* index.php
php_flag magic_quotes_gpc off
php_flag register_globals off
but it still the same problem. for my picture i checked it's in my server. any idea

Posted: Wed Aug 22, 2007 6:41 am
by dude81
make
RewriteEngine off
in the images folder

Posted: Wed Aug 22, 2007 6:48 am
by nahydy
i set RewriteEngine off in .htaccess ,but i still can not display my image.

Posted: Wed Aug 22, 2007 7:09 am
by dude81
Can you paste .htaccess file

Posted: Wed Aug 22, 2007 7:15 am
by nahydy
i created a .htaccess in my directory /public which contains image

Code: Select all

RewriteEngine off
i do not see what's may cause this problem.

Posted: Wed Aug 22, 2007 7:58 am
by nahydy
hi i finally resolved my problem in fact this is it:
i added in my indexaction:

Code: Select all

$this->view->baseUrl=$this->_request->getBaseUrl();
and then in my index.phtml

Code: Select all

<html>
<head>
<title><?php echo $this->escape($this->title); ?></title>
</head>
<body>
<h1><?php echo $this->escape($this->title); ?></h1>

saluit
<img src="<?php echo $this->baseUrl;?>/public/images/tick.png">



</body>
</html>
and it worked very well. thanks for the help of everybody