Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 11:30:44 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155556 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Wanted: automatic image resizer  (Read 623 times)
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« on: November 22, 2011, 01:45:37 PM »

The Argos theme has a handy feature that auomatically resizes images upon upload. You can set image size per Media directory. This works fine, but it has a shortcoming: you have to set it manually for each directory. So when you yourself or a client creates a new directory, the images size has to be set as well. I have many clients with photo galleries, and I really miss a "master set & forget" option.

Of course you can instruct the client to set the dimensions, but in reality this is too much to ask to most clients. They simply forget it, of find it too technical. And there is also room for error. I prefer clients not to have this option, but then I have the problem they upload big files, with the problems that causes.

So, it would be a big improvement to have a "master resize" setting, so that ALL uploaded images are automatically resized to certain dimensions, also images in newly created directories. Or just an extension of the functionality, that sets the new sizes for all current and new subdirs, as well as the dir itself.

I would think this is not too difficult, using the already present resizer function in Argos theme. But it's too difficult for me as a non-coder. Can anyone help me out? I guess this is a feature that many users would appreciate.
« Last Edit: November 22, 2011, 01:50:03 PM by Argos » Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #1 on: November 22, 2011, 02:51:19 PM »

I need to have the current code to take a look at how a 'Master' resize can be set.

Currently thinking of two options
1 - resize is not set on given dir, use defaults
2 - when creating a dir, set default resize


John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« Reply #2 on: November 22, 2011, 03:20:42 PM »

I need to have the current code to take a look at how a 'Master' resize can be set.

Currently thinking of two options
1 - resize is not set on given dir, use defaults
2 - when creating a dir, set default resize

Current code is in WB/admin/media/resize_img.php and is called from within the Argos theme template. Your setup idea seems excellent.
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Bug

Offline Offline

Posts: 188


« Reply #3 on: November 22, 2011, 07:16:21 PM »

The best option would be a resize function where judt before the user uploads the file he can set the width or height and has a default of 900 so images never get uploaded in an unnesescary  big size.

Guess what... I has itz
Logged
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« Reply #4 on: November 22, 2011, 08:05:43 PM »

The best option would be a resize function where judt before the user uploads the file he can set the width or height and has a default of 900 so images never get uploaded in an unnesescary  big size.

Guess what... I has itz

WB can only resize uploaded files, but it's always best to resize before upload. The problem is that this is a rather technical and difficult task for the typical non-technical website client, even with simple to use resize software. It's the clients that I aim at with my request, not the admins.
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #5 on: November 22, 2011, 09:04:19 PM »

Quote
The Argos theme has a handy feature that auomatically resizes images upon upload. You can set image size per Media directory.
Where is the code wich looks over the settings per media directory?
I haven't seen that on argos theme

Need to know how that is done, then hooking a default size would be easy.

John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« Reply #6 on: November 23, 2011, 01:28:14 AM »

I guess it's the file WB/admin/media/setparameter.php
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #7 on: November 23, 2011, 08:12:15 AM »


change in WB/admin/media/setparameter.php lines 99-100:
Code:
$cur_width = ($cur_width ? (int)$cur_width : '-');
$cur_height = ($cur_height ? (int)$cur_height : '-');

to
Code:
$cur_width = ($cur_width ? (int)$cur_width : 600);
$cur_height = ($cur_height ? (int)$cur_height : 400);
to make it's width 600 and height 400, remember this is hardcoded!!
Change size to your needs.

Can't see an option to set defaults wihtout coding to much in core.





John

Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #8 on: November 23, 2011, 09:47:58 AM »

perhaps to add additional settings for width and height in settings table ?
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« Reply #9 on: November 23, 2011, 11:32:04 AM »

Hi John, that sets the value allright, but it doesn't work unless you save it manually in the parameter settings. So it's a step forward, but we're not quite there yet  grin We have to get that hardcoded values in the database automatically.
« Last Edit: November 23, 2011, 11:35:49 AM by Argos » Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« Reply #10 on: November 23, 2011, 12:33:04 PM »

I found it. You need to set the dimensions in WB/admin/media/upload.php. Change lines 108-114 from:

Code:
if(file_exists($relative.$filename)) {
if ($pathsettings[$resizepath]['width'] || $pathsettings[$resizepath]['height'] ) {
$rimg=new RESIZEIMAGE($relative.$filename);
$rimg->resize_limitwh($pathsettings[$resizepath]['width'],$pathsettings[$resizepath]['height'],$relative.$filename);
$rimg->close();
}
}

to:

Code:
if(file_exists($relative.$filename)) {
if ($pathsettings[$resizepath]['width'] || $pathsettings[$resizepath]['height'] ) {
$rimg=new RESIZEIMAGE($relative.$filename);
$rimg->resize_limitwh($pathsettings[$resizepath]['width'],$pathsettings[$resizepath]['height'],$relative.$filename);
$rimg->close();
}
else {
$rimg=new RESIZEIMAGE($relative.$filename);
$rimg->resize_limitwh('1024','768',$relative.$filename);
$rimg->close();
}
}

if you want to set images to a default of max 1024x768. However, if you set dimensions manually in the parameters, then those values will be used instead of the default ones. In other words: all images will be resized to max 1024x768, unless you set otherwise in the media parameters.

Problem solved! To make it more user friendly, it would be nice to be able to set the defaults in the media admin, instead of hard coded in upload.php.
« Last Edit: November 23, 2011, 01:06:54 PM by Argos » Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!