Forum Activity for @tig

TiG
@tig
01/21/20 08:49:35PM
184 posts

Max-width for img tags


Jamroom Developers

We have users dropping in large images within comments (and discussions/blogs) which sometimes go past the maximum width of the text area (and thus are truncated). The natural solution would be to inject style="max-width:100%;" for the img tag.

Unfortunately the html_purifier (called via the update form) strips max-width. I have attempted dissuade html_purifier but ran into the finalization problem discussed years ago on this forum (with no resolution). My guess is that it is still a nightmare to try to influence html_purifier attributes.

So basically I am looking for a suggestion. The question essentially is: how can one get style="max-width:100%;" to remain in effect for img tags that are edited (and thus filtered)?
updated by @tig: 04/29/20 04:34:33AM
TiG
@tig
12/02/19 09:41:28PM
184 posts

Image URL for use in CSS


Jamroom Developers

Michael

You were understanding just fine. Basically the system works as I was expecting it to work. I must have mistyped the variable when I first tried to do this (before I started trying other things) because what you describe is exactly how I had things set up. I just did it again and it works as expected.

Thanks!
TiG
@tig
12/02/19 09:18:28PM
184 posts

Image URL for use in CSS


Jamroom Developers

Hi Michael

I am trying to pull the image from the img folder for a custom module. Apparently I need to do something to cause that module url (myModule_img_url) variable to be generated. jrAudio has such a variable but I do not see where it was generated.

Thanks
TiG
@tig
12/02/19 08:45:06PM
184 posts

Image URL for use in CSS


Jamroom Developers

Is there a way to generate a variable like $jrCore_img_url to be used in CSS for a module?

For example: on a user module: ntMyModule, I would like to have a variable to allow:

background: url("{$ntMyModule_img_url}/myimage.png");

Thanks
updated by @tig: 03/04/20 09:26:57AM
TiG
@tig
09/02/19 10:49:44PM
184 posts

Converting Visitor to Member


Jamroom Developers

Okay, thanks Michael.
TiG
@tig
09/02/19 10:24:16AM
184 posts

Converting Visitor to Member


Jamroom Developers

We are planning to build a module that caters to site visitors and makes it extremely easy for them to become members.

The first step is to find the best way to intercept a visitor accessing the site. The 'session_started' listeners are invoked multiple times on a single HTTP message from a single visitor (e.g. press F5 and the jrUser listener is invoked repeatedly). This leads me to think that this event is not the proper spot to insert a visitor conversion UI.

If there is an ideal spot to detect a visitor's first access of the site (the initiation of a visitor session) so that we can offer them a convenient conversion to member I would appreciate the insight.
updated by @tig: 12/03/19 01:41:37PM
TiG
@tig
01/15/19 08:23:13PM
184 posts

Moving a media image file


Jamroom Developers

Michael

It is amazing what you know of JR. Will locate this module and follow its lead.

Thanks!,
TiG
TiG
@tig
01/15/19 03:30:16PM
184 posts

Moving a media image file


Jamroom Developers

We have a need to move an image media file from one profile to another. The ideal function would be a rename because there is no functional need to read and write the file - just to literally change the hosting profile.

Basically I want like to build a function like jrCore_rename_media_file($profile_id, $current_name, $new_name); but with a $from_profile_id and a $to_profile_id parameter instead of simply $profile_id.

My concern is twofold:

1. Want to avoid reading and writing the image file if possible (no need to consume the needed resources)
2. Want to implement a future-proof solution. That is, to avoid accessing volatile functions.

How would you recommend I approach this problem?
updated by @tig: 04/20/19 12:05:59PM
TiG
@tig
01/01/19 08:22:37AM
184 posts

new value


Jamroom Developers

Brian

I agree, this is a hack but it is fail-safe. The worst case scenario is to wind up where I was. So I went ahead and implemented it. Hopefully this addresses the confusion.

To implement, I introduced a bit more surgical code that focuses on a specific field and works even if the user has customized the label. In case others wish to use this method, here is the operative function (ntCore is the the core for NT modules):

/**
 * Change the default 'new value' label to $label in a 'select_and_text' field with id of $field
 * @param  string - $content - the HTML content of a form to be displayed
 * @param  string - $field - the id of the subject 'select_and_text' field
 * @param  string - $label - the new label to replace the default of 'new value'
 * @return string - the modified content (original content if no modification made)
 */
function ntCore_relabel_new_value_field($content,$field,$label)
{ $signature = 'id="' . $field . '_select"'; // signature for field if (strpos($content, $signature) >= 0) // avoid unnecessary preg { $_ln = jrUser_load_lang_strings(); $target = $_ln['jrCore'][48]; // current label to replace $pattern = '~(.+' . $signature . '.+form_select_and_text_tag">)(' . $target . ')(<.*)~s'; $replace = '$1' . $label . '$3'; $new_content = preg_replace($pattern,$replace,$content,1); return $new_content ? $new_content : $content; } else return $content; }

Thanks again for providing critical info for me to make progress.

Happy New Year,
TiG
TiG
@tig
12/31/18 01:10:46PM
184 posts

new value


Jamroom Developers

The select_and_text form field type provides a box for the user to enter a custom value. This box is always labeled 'new value' (or what is placed in lang [48]).

I would like to provide a more descriptive label (one that varies per instance) to mitigate user confusion. There does not seem to be any way to accomplish this (other than to create a new field type).

Anyone know of a way to adjust the 'new value' label per instance?
updated by @tig: 04/08/19 10:34:58PM
  5