Quality must range from 0 to 100 image intervention laravel 8 - image-processing

i am facing this issue while resizing image.
$brand_image=$request->file('brand_image');
$img_name=time().$brand_image->getClientOriginalName();
$img=Image::make($brand_image)->resize(30,20);
$img->save('images/brands/',$img_name);

$img->save('images/brands/'.$img_name);
with dot (.) for concatenation not comma (,)
I solved it in my case:
Image::make($image)->resize(300,300)->save('upload/brands/'.$name_gen);

Related

Want file in CSV. I need a Regex to change a space to a comma on each line EXCEPT the Description Field which should remain with a space

Goal:
I want a CSV file as my result. I want to change the space char to a comma on each line of data. BUT, I also need the data for the 3rd field (Description) to remain as is with original space chars. Each line of data is terminated with a newline char.
Flipping spaces to commas on every line is easy with regex. But how do 'bookend' the string of text which will then become the 3rd/Description field and preserve its spaces? Currently I manually change commas back to spaces just in that text string. Painful.
Example of Final result needed (including column names)
Transaction Date,Posting Date,Description,Reference Number,Account Number,Amount
12/23,12/24,GOOGLE*DOMAINS SUPPORT.GOOGLCA,7811,8550,12.00
My sample data:
12/23 12/24 GOOGLE*DOMAINS SUPPORT.GOOGLCA 7811 8550 12.00
01/02 01/04 CREPEVINE - OAKLAND OAKLAND 234567 CA 1087 8220 16.32
01/06 01/07 AB* ABEBOOKS.CO J6YDBX HTTPSWWW.ABEBWA 6289 85332 6.98
01/20 01/21 SQ *BAGEL STREET CAFE Oakland CA 2313 44444 24.43
A few of My Regex attempts
This cmd changes spaces to commas over all 5 lines by combining it with Join cmd. Easy.
And just fyi: "\n" would not work for some reason so I do the <Ctrl+Enter> keys to inject a newline char, ie the two lines. For now it orks fine.
=regexreplace(join("
",A1:A5)," ",",")
RESULT:
12/23,12/24,GOOGLE*DOMAINS,SUPPORT.GOOGLCA,7811,8550,12.00
...
01/02,01/04,CREPEVINE,-,OAKLAND,OAKLAND,CA,1087,8550,16.32
...
Here is my poor attemp to bookend the description field, then flip commas back to spaces, but no luck either.
=REGEXREPLACE(A1,"(,[A-Z]+[A-Z],)"," ")
How do I craft a regex to do this?
cheers,
Damon
Using Regex101 to reverse learn how you did it
Can you try:
=index(if(len(A:A),regexreplace(A:A,"(?U)(.*) (.*) (.*) (\d[^A-Za-z]*) (\d.*) (\d.*)","$1,$2,$3,$4,$5,$6"),))

GREP to find a sequence of characters without a closing apostrophe

I'm trying to find long quotes in the text that I'm editing so that I can apply a different style to them. I've tried this GREP:
~[.{230}(?!.~])
What I need is for the GREP to find any 230 characters preceded by a left/opening quote mark, not including any 230-character sequence including a character followed by a right/clsoing quote mark. This should then eliminate quotes of less than 230 characters from the search. My GREP finds the correct length sequence but doesn't exclude those sequences which include a right quote mark.
So I want to find this, which my GREP does:
But not this, which my GREP also finds:
Because it has a closing quote in it and is therefore what I'm classing as a short quote.
Any ideas? TIA
You can match an opening ‘ followed by 230 or more occurrences of any character except an opening or closing quotation mark.
To not match the closing quotation mark, you can assert it using a positive lookahead.
‘[^‘’]{230,}(?=’)
‘ Match ‘
[^‘’]{230,} Repeat 230+ times any char except ‘ or ’ using a negated character class
(?=’) Positive lookahead, assert ’ directly to the right
See a regex demo.
Thanks #Thefourthbird.
So what I needed was:
‘[^’]{230,}
to search for an opening apostrophe ‘ followed by anything but a closing apostrophe [^’] of 230 characters or more {230,}
Strangely, if you use InDesign's code for left ~[ and right ]~ apostrophe it doesn't work!

Regex pattern for checking name with limited characters

I have a requirement to validate username with some special characters in it('-) and white space in it. I am able to achieve this with the help of the following regex -
^[a-zA-z]+([ '-][a-zA-Z]+)*$
But I am unable to add a limit to the maximum number of characters that user can enter say 25 to this particular regex. So can any one please explain how to do the same for the above regex? Thanks.
You may add a negative lookahead at the beginning disallowing 26 or more chars:
^(?!.{26})[a-zA-Z]+([ '-][a-zA-Z]+)*$
^^^^ ^
You also have a typo [A-z], it must be [A-Z]. See Difference between regex [A-z] and [a-zA-Z].
The negative lookahead (the (?!...) construct above) is anchored at the start of the string (meaning it is placed right after ^), and the length check is performed only once, right before parsing with the main, consuming pattern part.
You can also see more on how a negative lookahead works here.
Just add a lookahead at the beginning to match only for a max of 25 characters by adding a (?=.{1,25}$).
Your new regex will be: ^(?=.{1,25}$)[a-zA-z]+([ '-][a-zA-Z]+)*$

OpenTsdb: Is Space character allowed in Metric and tag information

I was working with openTsdb and came across with the issue that space character is not allowed in metric, tag(tagk) and even the values(tagv). Is there any way we can add space atleast in the value of tag?
I also referred: http://opentsdb.net/docs/build/html/user_guide/writing/index.html#metrics-and-tags
As of opentsdb version 2.3 there is support for specifying additional characters to allow via the config variable
tsd.core.tag.allow_specialchars = !##$%^&*()_+{}|: <>?~`-=[]\;',./°
http://opentsdb.net/docs/build/html/user_guide/configuration.html gives more details
Spaces are not allowed.
As per the documentation you referred:
Only the following characters are allowed: a to z, A to Z, 0 to 9, -, _, ., / or Unicode letters (as per the specification)
I suggest you should use '_' in stead of spaces.

Superscripting any Letter/Number for comma

I am getting some problem while getting below output.
Expected OutPut :
a2,3 = a\u00B2\u066B\u00B3
Actual Output :
a2,3 = a\u00B2\u066B\u00B3
Kindly review my question and reply soon.
Thanks in advance
There's no Superscript comma in Unicode.
However there are :
Superscript plus sign (U+207A): ⁺
Superscript minus sign (U+207B): ⁻
Superscript equals sign (U+207C): ⁼
Superscript left parenthesis (U+207D): ⁽
Superscript right parenthesis (U+207E): ⁾
Maybe you can use some other glyph, like the "dot operator" (U+22C5) to simulate a superscript comma: ¹⋅³².
You can also, of course, use NSAttributedString with a smaller font-size and an up-shifted baseline offset to simulate superscripting. However NSBaselineOffsetAttributeName is only available starting with iOS 7.

Resources