1

Topic: how to resize image from client_helper?

Good evening, i was restyling my code to submit a sample/occurrence using data_entry_helper function from client_helper and i was wondering if if there is any params to set inside data_entry_helper to resize image when i use the function data_entry_helper::forward_post_to
Up to now i resize my images before using this function, in my app but surely (or i hope) there should be a way to let resize it from API... any idea? thanks

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

2

Re: how to resize image from client_helper?

Hi

Usually I use the data_entry_helper::file_box() which does image resizing in the browser before the image is submitted to the server. This helps to improve performance for the user.

There is nothing built in to the data_entry_helper library to do server-side resizing as far as I know but there are PHP libraries such as GD which will do this.

Jim Bacon.

Jim Bacon

3

Re: how to resize image from client_helper?

Hi Jim, ok... so for the moment i will resize image inside my app before submitting to the library and then i will study how to resize with some PHP library...

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

4

Re: how to resize image from client_helper?

Other question: i have seen the pics associated to the submissions done in these years and i have noticed that they have 1024px width and height higher than the image i have sent using client_helper libray (i send images under 1024x768px). Is there some resize inside warehouse or inside indicia modules in drupal? i have seen the info of files are resized using GD or something like... is it possible? Thanks

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

5

Re: how to resize image from client_helper?

Hi Carlo
There are 2 potential places where Indicia can resize images. The first, as Jim points out, happens in the file_box control which resizes images in the browser before uploading, with the intention of ensuring that image upload is fast. Note that the availability of this feature does depend on browser version and plugins available so some old browsers do not support it and will upload full size images.
The second happens on the warehouse. In application/config/indicia.php, there is a configuration variable $config['image_handling'] which defines the size of images that will be created in the upload folder, allowing you to create thumbnails and other image sizes automatically. The code to handle this is in application/libraries/MY_Image.php. You can also have a different configuration for each website by creating config variables called image_handling_website_n where n is the website ID.
Cheers
John

John van Breda
Biodiverse IT