Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7884171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:43:37+00:00 2026-06-03T04:43:37+00:00

I’m new to Zend Framework, so forgive me if this is a basic question,

  • 0

I’m new to Zend Framework, so forgive me if this is a basic question, but I’m having a heck of a time, displaying an image retrieved from the database.

Edit: I basically can’t access any resource from the /public/ folder. I’m guessing the front controller is redirecting src requests inside <link> tags and <img> tags. Everytime I search, I see people having problems accessing images outside the /public/ folder… but they seem to be fine as long as they’re stored under the /public folder. What am I doing wrong?

I’ve got the following code in a view partial:

<?php
$user = Zend_Layout::getMvcInstance()->getView()->user;

?>
<section class="one-fifth first sidebar_profile">
  <div class="one-fifth first about_img"><img src="<?php if($user->picture){echo '/public/img/users/small_thumbs/'.$user->picture;}else{echo "#";}  ?>" alt="name"/>
      <p class="name"><?php  if($user) {echo $user->username; } else { echo "Username";} ?></p>

Doing a dump of $user gives me the following:

object(Zend_Db_Table_Row)[70]
protected '_data' => 
array
  'userID' => string '22' (length=2)
  'username' => string 'test' (length=4)
  'firstName' => string '' (length=0)
  'lastName' => string '' (length=0)
  'email' => string 'test@google.com' (length=18)
  'password' => string '098f6bcd4621d373cade4e832627b4f6' (length=32)
  'picture' => string '4fa3072fe09a5.jpg' (length=17)
  'verified' => string '1' (length=1)
  'confirm_key' => null
  'admin' => null

It goes on quite a while, but the point is the file is there. Looking at the source code from the page that’s rendered, the line in question is rendered as:

<img alt="name" src="/public/img/users/small_thumbs4fa3072fe09a5.jpg">

Should I be using some sort of view helper to display this? I’ve searched and searched, and couldn’t find one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:43:39+00:00Added an answer on June 3, 2026 at 4:43 am

    Technically if you’re using frameworks, you shouldn’t be doing Logic in your View. You should do the if/else statement in your Controller and in your View simply do:

    <div class="one-fifth first about_img"><img src="$img"/></div>
    

    But as for your question goes, if you copy paste the src attribute in your browser, does it show the picture?

    This is my .htaccess. It serves directly any file that extensions match this regular expression, and redirects everything else to my index.php which is my bootstrap file.

    RewriteEngine On
    RewriteRule \.(shtml|js|ico|gif|jpg|png|css|flv|swf|swz)$ - [NC,L]
    RewriteRule ^.*$ index.php
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.