Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Help with php code on a template for images

    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.

  • #2
    Regular Coder
    Join Date
    Aug 2009
    Posts
    131
    Thanks
    28
    Thanked 7 Times in 7 Posts
    Code:
    <img src="images/image.gif" width="50%" height="50%" />
    That should do it.

  • #3
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    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.
    Are you a Help Vampire?

  • #4
    Regular Coder
    Join Date
    Aug 2009
    Posts
    131
    Thanks
    28
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by tomws View Post
    Vengeance probably meant to suggest the CSS solution
    I actually had that in mind as a solution, but forgot about it for a moment.

  • #5
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!!


  •  

    Posting Permissions

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