Jump to content

[SOLVED] images not showing on page using PHP


Recommended Posts

hi,

got a weird prob..  i'm working on a framework to create pages from templates, all works fine, exept showing images on page.

i try to load them from a stylesheet (css), but the images aint showing or just a distorted part of it.

also tried to put in html tags (<img src>) to the file, but same result.

when i create a page using ONLY html/css it all works like u expect, but once back in the main programme i get this 'error'. the weird part of this prob is that eg very small images (gif/jpeg) show normally. only the bigger(35k) ones dont. also small images using repeat (css) as eg banner are working fine.

 

part of css code:

div#logo{background: transparent url('../img/tmcn_logo.gif') no-repeat;}  (~35k)DISTORTED IMG

div#logo{background: transparent url('../img/delete.gif') no-repeat;}  (1k)OK

div#logo{background: transparent url('../img/header.jpg') repeat right;}  (1k)OK

 

 

the application loads a header file(HTML), replaces some tags, then the content part(HTML) is loaded and at the end it loads the footer file(HTML), all gets echoed to the browser. 1st i was thinking of a header problem (allready sent), but this isn't the case. also tried to embed the php stuff into the html, so the style wont be 'affected' by the php part and the style sheet would load before any php code executes - same result.

 

when i create some dummy images (blue square) it shows correct. even when i load it thru the css file - what i want.  also on another page i show images from a database, all are shown correctly.

i could put all images (backgrounds) into the database, but this is not a solution to this problem. i just need them in the css or in the html file itself using img tag.

 

maybe there's something i didnt think of? i never encountered this problem before  :o 

hopefully there's a simple solution for this.

 

thanx in advance

 

 

wanted to include a screenshot but cant upload.

 

It honestly sounds like a problem with your image path...tho it doesn't make sense that some images are loading, and some aren't.

 

When you view source in firefox, if <img src=""> is echoing correctly with the right path, try right clicking on the image and going "view image"

 

That, or try navigating directly to some of the images in your address bar. 

thanx for your reply  :)

 

the path is for all images the same.......

when i view page source all looks like it should.

but when i right-click and show image, it just looks like on page. this is also the case when i navigate directly to the image.  now i begin to suspect apache to be the culprit.

it's like the image is cut off in the middle with some residual garbage.  ???

That's strange behavior.  If you're not getting a broken link, it's unusual for an image to just halfway load or load distorted.

 

So if the source code looks correct, when you navigate directly to the image via the address bar it still look distorted?

 

like http://localhost/yoursite/images/imagename.jpg

 

If that doesn't show up as broken, but shows up as distorted...then I don't know what to tell you.  The only other thing I can think of is maybe you have some CSS problems.  Is the behavior the same in different browsers?  It would be unusual for apache to display an image incorrectly

 

Do you have a place where you can post the site?  I can take a look at it (mainly at your CSS) and see if I see anything strange.  Or can at least validate that the behavior is happening on my side as well.

 

If you don't have a place to host it right now, you can e-mail the sites contents to me steveflee@gmail.com and I can take a loo k at it that way too =)

it's solved.....

i was nearly collapsing and if you look closely you can see the bitemarks in my compy  ;D

as i said before i was beginning to suspect the apache server as the culprit, thus i installed a newer version, and this time a local install. (site looked the same when viewed on the server pc) now all works as expected.

good part is that it prolly wasnt my coding skills  ;)

bad part is i look a bit lame posting such a prob  :-\

 

anyway.... thanks a lot for your help!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.