auto resize image in featured, blog and article post

General questions relating to Joomla! 2.5. Note: All 1.6 and 1.7 releases have reached end of life and should be updated to 2.5. There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Post Reply
shaibustephen
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Sat Nov 17, 2018 1:52 pm

auto resize image in featured, blog and article post

Post by shaibustephen » Sat Nov 17, 2018 1:55 pm

Is there any php functions one can add to the joomla theme so that image will auto resize itself if it appears in featured page (Thumbnial image), blog post and article post. Let give an instance that you initially have image size height 800px, width 700px. In the featured image you want it to be auto resize h=80px, w=100px, blog image h=400px, w=500px, article image h=500px, w=600px. Or can we use css to do this or is there any other method to get this done without necessary manually resizing this respective images?
Last edited by shaibustephen on Sat Nov 17, 2018 2:23 pm, edited 1 time in total.

SharkyKZ
Joomla! Ace
Joomla! Ace
Posts: 1562
Joined: Fri Jul 05, 2013 10:35 am
Location: Unknown

Re: auto resize image in featured, blog and article post

Post by SharkyKZ » Sat Nov 17, 2018 2:07 pm

There are plugins that dynamically resize images. Some examples:

https://extensions.joomla.org/extension ... humbnails/
https://extensions.joomla.org/extension/bk-multithumb/
https://extensions.joomla.org/extension/jdvthumbs/

You can use CSS too but that will only change the styling and not the actual size of the image being served.

shaibustephen
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Sat Nov 17, 2018 1:52 pm

Re: auto resize image in featured, blog and article post

Post by shaibustephen » Sat Nov 17, 2018 2:25 pm

i dont want to use any extention. how do i go by using the css?

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11046
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK

Re: auto resize image in featured, blog and article post

Post by toivo » Sat Nov 17, 2018 3:28 pm

If you do not want to create several versions of the image, you can find tutorials similar to these:
https://www.w3schools.com/css/css_rwd_images.asp
https://www.w3schools.com/howto/howto_c ... onsive.asp

About your examples of resizing: it is important to maintain the aspect ratio, as highlighted in the following tutorial: https://www.computerhope.com/issues/ch000055.htm
Toivo Talikka, Global Moderator
troubleshooting smtp and other articles http://talikka.com/joomla

shaibustephen
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Sat Nov 17, 2018 1:52 pm

Re: auto resize image in featured, blog and article post

Post by shaibustephen » Sat Nov 17, 2018 4:45 pm

But, is there any php functions that could handle this effectively

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11046
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK

Re: auto resize image in featured, blog and article post

Post by toivo » Sat Nov 17, 2018 5:19 pm

I would use extension add-ons like Image Manager Extended of JCE - https://extensions.joomla.org/extension/jce/
- but there are PHP functions if you need to do these operations "manually":

http://php.net/manual/en/function.imagecopyresized.php
http://php.net/manual/en/function.imagescale.php

-and there are also cloud services:
https://github.com/gumlet/php-image-resize
Toivo Talikka, Global Moderator
troubleshooting smtp and other articles http://talikka.com/joomla

SharkyKZ
Joomla! Ace
Joomla! Ace
Posts: 1562
Joined: Fri Jul 05, 2013 10:35 am
Location: Unknown

Re: auto resize image in featured, blog and article post

Post by SharkyKZ » Sat Nov 17, 2018 5:43 pm

shaibustephen wrote:
Sat Nov 17, 2018 4:45 pm
But, is there any php functions that could handle this effectively
Yes, see the plugins linked above.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 25665
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: auto resize image in featured, blog and article post

Post by Per Yngve Berg » Sat Nov 17, 2018 6:23 pm

You can set the size of the images shown by altering the css of your template.

User avatar
sozzled
Joomla! Champion
Joomla! Champion
Posts: 7154
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: auto resize image in featured, blog and article post

Post by sozzled » Sat Nov 17, 2018 6:45 pm

I'm having trouble following the discussion. In the first place, the OP asks about using PHP functions to resize images (and indirectly refers to CSS to achieve the same result). Then, in msg #3, the OP asks about how to use CSS. In msg #5, the OP returns to asking about how to use PHP. :eek:

In all of this, we're discussing J! 2.5 which has been dead for four years.

Now, I don't know about the rest of you who may be wondering about how to resize images on websites, but I haven't found a good reason that requires PHP to resize/rescale a fairly basic image that someone might want to display on a website.

Likewise, displaying large images (e.g. 800px x 700px) as "thumbnails" that are 1/10th of the original size can also be achieved with CSS. Unless we're discussing the possibility of hovering-over/clicking thumbnails in order to display the original/full-sized image, rescaling the images can also be done with CSS. In the case of hovering-over/clicking an image to display the image (perhaps in a lightbox), this is done with Javascript.

PHP is a progamming language that is used on webservers to package HTML for delivery to the client (i.e. the browser); how that image appears on the browser is the whole purpose of the browser. Web browsers don't "speak" PHP. So, while all this discussion about PHP is fascinating (in an academic sense), how why don't we discuss the real problem which is about not migrating the website to J! 3.x? :pop
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 25665
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: auto resize image in featured, blog and article post

Post by Per Yngve Berg » Sat Nov 17, 2018 8:54 pm

The best solution to this, is upgrade your site to the current version 3.9.0 of Joomla and get a proper responsive template.

shaibustephen
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Sat Nov 17, 2018 1:52 pm

Re: auto resize image in featured, blog and article post

Post by shaibustephen » Mon Nov 19, 2018 6:41 pm

but how can one use Java script or jquery to get this done aside using css


Post Reply

Return to “General Questions/New to Joomla! 2.5”