Results 1 to 14 of 14

Thread: <img src="... is not displaying image

  1. #1
    Join Date
    Jul 2014

    <img src="... is not displaying image

    I am trying to display image in the following form and its not showing the photo :

    <form action="" method="post">     
    Select Employee name for photo update :<select name=empid>$options</select><br>     
    Enter full path with photo name :<input name="path" value="$upload_dir/$filename"><br>     
    <IMG SRC="$upload_dir/$filename" WIDTH ="350" HEIGHT="500" ALIGN="Right" BORDER ="10" BORDERCOLOR="#333"><br>  
    <input type="submit" class="tsc_c3b_large tsc_button tsc_c3b_blue tsc_c3b_input" name="go" value="UPDATE" />     
    Here is the html source of the form :

    Showing full path with photo name :<input name="path" value="/var/www/html/tmp/steven.jpg" readonly><br>
    <IMG SRC="/var/www/html/tmp/steven.jpg" WIDTH ="350" HEIGHT="500" ALIGN="Right" BORDER ="10" BORDERCOLOR="#333"><br>
    <input type="submit" class="tsc_c3b_large tsc_button tsc_c3b_blue tsc_c3b_input" name="go" value="UPDATE" />
    if I copy /var/www/html/tmp/steven.jpg in my browser the image shows up fine and even with that path the update of the photo to the database goes through fine.

    I gladly appreciate any help as I really don't have a clue why this is happening.

    Many thanks!

  2. #2
    Join Date
    Apr 2014
    It looks like your img tag isn't closed. Shouldn't it be:
    <IMG SRC="/var/www/html/tmp/steven.jpg" WIDTH ="350" HEIGHT="500" ALIGN="Right" BORDER ="10" BORDERCOLOR="#333"/> - note the forward slash


  3. #3
    Join Date
    Jul 2014
    Thanks for your reply but that did not work either here is the source :
    Showing full path with photo name :<input name="path" value="/var/www/html/tmp/nancy.jpg" readonly><br>
    <IMG SRC="/var/www/html/tmp/nancy.jpg" WIDTH ="350" HEIGHT="500" ALIGN="Right" BORDER ="10" BORDERCOLOR="#333"/><br>
    <input type="submit" class="tsc_c3b_large tsc_button tsc_c3b_blue tsc_c3b_input" name="go" value="UPDATE" />
    Any other suggestions or something that I can try.

  4. #4
    Join Date
    Feb 2014
    try by adding ".."in front of path..

    <IMG SRC="../var/www/html/tmp/nancy.jpg" WIDTH ="350" HEIGHT="500" ALIGN="Right" BORDER ="10" BORDERCOLOR="#333"/>

  5. #5
    Join Date
    Jul 2014
    Check whether the image source is correct or not...

  6. #6
    Join Date
    Apr 2014

    How did you get on with this, any luck?


  7. #7
    check the folder again .There may be problem in resolution of the image .try another image .

  8. #8
    Join Date
    Nov 2013
    It seems path is wrong here. Try by removing '/' or by adding '../' this may helps or see you have given space for the width attribute remove that space.

    Make sure path should be correct.

  9. #9
    Join Date
    Mar 2011
    Yes, the path is obviously incorrect. "/var/www/html/tmp/nancy.jpg" is the server directory path to the image. You need to change it to be relative to the domain root, which would be:
    <img src="/tmp/nancy.jpg" style="width:350px; height:500px; border:solid 10px #333;" alt=""/>
    Rick Trethewey
    Rainbo Design

  10. #10
    Quote Originally Posted by rtrethewey View Post
    Yes, the path is obviously incorrect
    That's my take on it too -- well, along with all the other stuff that's just broken/gibberish HTML and bad coding practices -- like the static style in the markup, tags in caps like the OP is still writing HTML 3.2, attributes like BORDER that have no business on any website written after 1997 and attributes like BORDERCOLOR that never actually even existed...

    Even the nesting order is junk -- since you can't have CDATA or inline-level tags as direct children of FORM.

    I mean, no FIELDSET, no LABEL around your obvious text labels...

    Then there's the broken image URL that is quite obviously a server path, not a web path. $uploadDir is quite obviously the local path, I SUSPECT that you should probably just have 'tmp/' there... or '/tmp/'... NOT that a temp directory makes a lot of sense in this case.

    Though your double quotes while having $ values doesn't make a lot of sense either... and it's also not clear if you're using HTML or XHTML since you seem to have both closure methods in there.

    Guessing wildly, but:

    // assuming you're in a single quoted echo like a good little doobie
    echo '
    <form action="#" method="post">
    		<label for="empid">Select Employee name for photo update:</label>
    		<select name="empid" id="empid">$options</select>
    		<label for="empPhotoPath">Enter full path with photo name:</label>
    		<input type="text" name="path" id="empPhotoPath" value="/tmp/', $filename, '" />
    			src="/tmp/', $filename, '"
    			alt="Employee Photo Preview"
    			width ="350" height="500"
    		<input type="submit" class="submit" value="UPDATE" />
    Probably would make more sense. Naturally, all that styling you were doing has no business in the markup and belongs in your stylesheet. Oh, and should that be text or file for that input? The "enter full path" part doesnae make a whole lot of sense.

  11. #11
    Join Date
    Aug 2014
    may be path is incorrect, you can find for mistakes or do this quick fix.
    simply open your online ftp manager , find the image you want to upload, and on properties or something, there must be an option of copting full path or copy embed src.
    now you know all the rest

  12. #12
    Join Date
    Aug 2014
    As well as the path, there's a space here
    <IMG SRC="/var/www/html/tmp/nancy.jpg" WIDTH ="350"
    right after width. I tried on my own and that ruins it for me. Try removing that

  13. #13
    check your image path is right or not.

  14. #14
    Join Date
    Jul 2014
    Dubai, United Arab Emirates
    Must add enctype="multipart/form-data" in the form like this, <form action="upload_file.php" method="post"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.14666 seconds
  • Memory Usage 2,988KB
  • Queries Executed 13 (?)
More Information
Template Usage (34):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (5)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (14)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (14)postbit
  • (14)postbit_onlinestatus
  • (14)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (71):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates