So I have a problem. On my site I have a Facebook Likebox the problem is when I run the Firefox extension Page Speed, I am told that the Facebook images that are loading with the Likebox (mostly 50x50 images of avatars of people that already like my company and 1 image that is 1x1) are loading without a height/width assigned to them. I am trying to figure out a way in PHP (I assume would work) to look at all images loaded by facebook (or might be easier to sort through all images that will be loaded and filter to the ones we want) and have

style = "height:50px;width:50px"

added to their <img tags? I have searched Facebook/Google for a way to disable the images from being sent altogether would be the best...I do not think it is possible. At least I have no clue on how to do it. Is this doable?

ohh wow! all I had to do was add

.img {
	height:50px;
	width:50px;
}

to my .css

soo easy and I've been looking for a fix for hours!

Or NOT... got too excited...that still doesn't work :(

This deal would need the PHP function: image_tag( string $source, array $options = array() )

What I need help doing is grabbing those Like Box loaded images (which are always named differently and no way to know what the file name> So the code will need to grab the image after the images for the Like Box have loaded(are able to be manipulated.) That image would need to be grabbed by putting the HTML into a string and searching for "<img." Find the particular class that we need and change their tags to include the height: and width:. Then just reload the html back out as new.

Although with the above function we just need to get the $source for the fb images and change them via that function. Trick is getting the right source...

Another idea was to build javascript to intercept their output to my browser and remove the images all together (or at least add the size tags to them) before outputting the html

Nothing from anybody????

Hi im not sure if this is what you are looking for, but ove the last few months I have been looking into how we view images from mysql database.

If you can get the image to the database ie. img1 field name,

you could then pull the image from the database and echo out the result(s)

and use the following to size your image

<img name='$img1' src='$img1' width='150' height='75' title='this is a title tag of imag' alt='$img1'/>

Okay...I can see that working...do you have any clue about how to get dynamically loaded images with dynamic file name into $img1 field? I was told by some that only way would be to somehow read the Facebook stream as it is being loaded and then do similar to what you suggested...the problem is reading that stream...some have suggested a Javascript(rather than PHP) stream reader and that makes some sense because the Facebook app is javascript but I feel lime the javascript would process too late to add those tags before the browser even has a chance to know anything about those pictures...I feel like PHP would have to get the stream, add those tags then output it to the browser...I have talked to several PHP people who say it is not likely to be possible...maybe I can intercept their css file and output my own?

It would be the easiest if I just knew what css tags I have to manipulate(their structure/names) so I can just add my own tags with the sizes in them...I have seen some discussion about this around the net...but nothing specific enough to implement on my site.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.