Field options are changed by accident during image (from field) display

3 views
Skip to first unread message

Alexander Obuhovich

unread,
Aug 24, 2011, 5:20:08 AM8/24/11
to In-Portal Bugs
Each In-Portal's database table field, that allows image upload to be performed is described with a set of upload-specific options in associated database table unit config file.

'Fields' => Array (
'Logo' => Array (
'type' => 'string',
'formatter' => 'kUploadFormatter',
'upload_dir' => IMAGES_PATH.'manufacturers/',
'file_types' => '*.jpg;*.gif;*.png', 'files_description' => '!la_hint_ImageFiles!',
'multiple' => false, 'thumb_format' => 'resize:100x100',
'max_len' => 255, 'not_null' => 1, 'default' => ''
),
),

There is also a rarely used option called "direct_links", that is turned off by default.

When this option:
  • is turned on, then path to image is shown to user (in url to that image), e.g. http://www.website.tld/system/images/manufacturers/image_filename.jpg
  • is turned off then path is totally hidden and intermediate In-Portal's event OnViewFile is used to display an image: http://www.website.tld/index.php?env=-page_template_here:m0--1--s-1:manuf-0---OnViewFile-t1&field=Logo&file=619339.jpg
So if you don't want to disclose actual location of file, then you'd probably with that option to be turned off (that is by default).

However, when you're trying to use 1 field to display any 2+ images not stored in that field:

$object->SetDBField('Logo', 'image1.jpg');
$url_one = $object->GetField('Logo', 'full_url');

$object->SetDBField('Logo', 'image2.jpg');
$url_two = $object->GetField('Logo', 'full_url');

then $url_one will have link with OnViewFile event, but $url_two will have direct link to an image.


That's a bug, since direct_link option is changed in the middle by mistake.


Ready for testing.


--
Best Regards,

http://www.in-portal.com
http://www.alex-time.com
dont_change_field_options_during_image_url_formatting.patch

Phil -- wbtc.fr --

unread,
Aug 24, 2011, 7:49:12 AM8/24/11
to in-port...@googlegroups.com
very interesting to be able to hide image path!

how do we use this direct_link function in tpl, and where do we turn it on/off ?


2011/8/24 Alexander Obuhovich <aik....@gmail.com>

--
You received this message because you are subscribed to the Google Groups "In-Portal Bugs Team" group.
To post to this group, send email to in-port...@googlegroups.com.
To unsubscribe from this group, send email to in-portal-bug...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/in-portal-bugs?hl=en.

Alexander Obuhovich

unread,
Aug 24, 2011, 8:47:16 AM8/24/11
to in-port...@googlegroups.com
As I said it's turned off by default.

Tag <inp2:prefix_Field name="ImageField" format="full_url"/> should do that.

But since we usually resize images before displaying by using <inp2:prefix_Field name="ImageField" format="resize:100x120"/>, then direct link to resized image in "resized" folder is created anyway.

Phil -- wbtc.fr --

unread,
Aug 24, 2011, 9:07:14 AM8/24/11
to in-port...@googlegroups.com
as far as it let be understood, "full_url" will show the path, right?

resized images can't benefit of this function then?

2011/8/24 Alexander Obuhovich <aik....@gmail.com>

Alexander Obuhovich

unread,
Aug 24, 2011, 9:10:49 AM8/24/11
to in-port...@googlegroups.com
as far as it let be understood, "full_url" will show the path, right?

Yes, url to an image.


resized images can't benefit of this function then?

Nope.

Phil -- wbtc.fr --

unread,
Aug 24, 2011, 9:12:02 AM8/24/11
to in-port...@googlegroups.com
and what's the parameter to have "obfuscated" link?


2011/8/24 Alexander Obuhovich <aik....@gmail.com>

Alexander Obuhovich

unread,
Aug 24, 2011, 9:16:55 AM8/24/11
to in-port...@googlegroups.com
I've already mentioned it in my original post. And it's field option, not a parameter, that can be specified in tag.

Phil -- wbtc.fr --

unread,
Aug 24, 2011, 9:37:08 AM8/24/11
to in-port...@googlegroups.com
format="direct_links" ?

Alexander Obuhovich

unread,
Aug 24, 2011, 9:43:34 AM8/24/11
to in-port...@googlegroups.com
Nope as I told, "direct_links" is field option, that written only in *_config.php files. You can't tell whatever to use it or not from template (I'm writing 3rd time about it already).

Phil -- wbtc.fr --

unread,
Aug 24, 2011, 11:30:53 AM8/24/11
to in-port...@googlegroups.com
ok, thanks !

2011/8/24 Alexander Obuhovich <aik....@gmail.com>
Reply all
Reply to author
Forward
0 new messages