Zend framework: problem with displaying images

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nahydy
Forum Commoner
Posts: 25
Joined: Wed Aug 22, 2007 5:55 am

Zend framework: problem with displaying images

Post 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]
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post 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) ?
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

can you paste your .htaccess rule.

Is there such image really on server.
nahydy
Forum Commoner
Posts: 25
Joined: Wed Aug 22, 2007 5:55 am

Post 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
nahydy
Forum Commoner
Posts: 25
Joined: Wed Aug 22, 2007 5:55 am

Post 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
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Post by dude81 »

make
RewriteEngine off
in the images folder
nahydy
Forum Commoner
Posts: 25
Joined: Wed Aug 22, 2007 5:55 am

Post by nahydy »

i set RewriteEngine off in .htaccess ,but i still can not display my image.
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Post by dude81 »

Can you paste .htaccess file
nahydy
Forum Commoner
Posts: 25
Joined: Wed Aug 22, 2007 5:55 am

Post 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.
nahydy
Forum Commoner
Posts: 25
Joined: Wed Aug 22, 2007 5:55 am

Post 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
Post Reply