...

View Full Version : Help with php code on a template for images



Mikebdoo
09-07-2009, 12:38 PM
Hi,
I have an interesting problem.

Our website publishes other sites RSS feeds (all above board I hasten to add). And we use php software to do this. The software basically publishes(prints) the feeds onto a .php template file which in turn is 'included' (using the <? include ("include/templatexxx.php") ?> command) on our web pages. There is often more than one feed published (included) on each page.

We have problems with images from some of our publishers that are far too big and we wish to be able to control the size of these images by reducing them all by say 50%.

I was wondering if anyone has a code that we can use on our php template pages that will automatically reduce the size of all images (img ) on the page.

Hope this makes sense.

[vengeance]
09-07-2009, 01:32 PM
<img src="images/image.gif" width="50%" height="50%" />


That should do it.

tomws
09-07-2009, 02:15 PM
Vengeance probably meant to suggest the CSS solution rather than modifying the image tag itself since you'd probably need to parse the feed and modify the tags with that method - not exactly fun. Probably apply it to something like div#wrapper img {}.

If you're willing to go to the effort of parsing anyway, you might consider feeding the images to GD or ImageMagick to resize them all to a common size if larger than desired. The effectiveness would depend upon how you actually handle the content on your end.

[vengeance]
09-07-2009, 02:21 PM
Vengeance probably meant to suggest the CSS solution

I actually had that in mind as a solution, but forgot about it for a moment. :D

Mikebdoo
09-08-2009, 03:16 PM
Hi,

Thanks for all your help.

The CSS is the answer. Using the following:

<style type="text/css">
<!--img { width:80px; height:80px; }
-->
</style>

Keep up the good work!!:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum