ID:260656
 
Today, for the first time since it's been available, I used the RGB+mask and alpha-only icon editor modes, and I found them highly convenient. I didn't, however, find any similar options for the SwapColor() proc, which I think would be equally as awesome to have that flexibility at runtime. There's a few instances where I have the same RGB with differing alpha values and would like to swap the RGB values while retaining the same alpha values, and one instance where I wanted to change just the alpha values of an icon.

I also think some kind of MIME type or filetype constant argument would be helpful in AllowUpload. Everyone loves to upload things they're not supposed to, and it would be helpful to, say, allow only sound uploads in your project, or apply differing upload limits on different filetypes.
Mobius Evalon wrote:
Today, for the first time since it's been available, I used the RGB+mask and alpha-only icon editor modes, and I found them highly convenient. I didn't, however, find any similar options for the SwapColor() proc, which I think would be equally as awesome to have that flexibility at runtime. There's a few instances where I have the same RGB with differing alpha values and would like to swap the RGB values while retaining the same alpha values, and one instance where I wanted to change just the alpha values of an icon.

Hah, that's funny, because I had this exact same thought just the other day. It is currently on a sticky on my computer.


I also think some kind of MIME type or filetype constant argument would be helpful in AllowUpload. Everyone loves to upload things they're not supposed to, and it would be helpful to, say, allow only sound uploads in your project, or apply differing upload limits on different filetypes.

Do you mean to display on the file GUI box? Because in the current system can just check the extension of the file and decide to limit things that way.
In response to Tom
Tom wrote:
Mobius Evalon wrote:
I also think some kind of MIME type or filetype constant argument would be helpful in AllowUpload. Everyone loves to upload things they're not supposed to, and it would be helpful to, say, allow only sound uploads in your project, or apply differing upload limits on different filetypes.

Do you mean to display on the file GUI box? Because in the current system can just check the extension of the file and decide to limit things that way.

Well, the AllowUpload proc currently has filename and filesize arguments, and I'm requesting a third argument containing a MIME-type or constant to identify the file's actual type. Grabbing the extension off the end of the file is what I'm doing currently, but there's easy ways to fool it into thinking something else was uploaded -- the most recent and common example I can think of is renaming an MP3 file to any other extension BYOND supports for music and it will accept and play it. Similar problems used to exist between types, such as renaming a PDF extension to DMI, but I think recently it started properly rejecting those at the client end.
In response to Mobius Evalon
the most recent and common example I can think of is renaming an MP3 file to any other extension BYOND supports for music and it will accept and play it.

If I wasn't afraid of legal issues, I would do that.
In response to Mobius Evalon
Mobius Evalon wrote:
Well, the AllowUpload proc currently has filename and filesize arguments, and I'm requesting a third argument containing a MIME-type or constant to identify the file's actual type.

As far as I know, Windows itself only picks a MIME type based on the file's extension. There would have to be some means of actually checking a file's contents to determine its type. The code for doing that would be somewhat prohibitive. In addition, it would complicate the upload process much further, since the AllowUpload() feature essentially is just using readily available info (filename and size) that's already part of the upload process.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Mobius Evalon wrote:
Well, the AllowUpload proc currently has filename and filesize arguments, and I'm requesting a third argument containing a MIME-type or constant to identify the file's actual type.

As far as I know, Windows itself only picks a MIME type based on the file's extension. There would have to be some means of actually checking a file's contents to determine its type. The code for doing that would be somewhat prohibitive. In addition, it would complicate the upload process much further, since the AllowUpload() feature essentially is just using readily available info (filename and size) that's already part of the upload process.

Lummox JR

How about a forward-compatible integer constant? Before BYOND went 4.0, I was determining sound files by checking for a .midi or .wav extension, then after the 4.0 switch I had to dust off an old segment of code to include .mod, .s3m, .it and others, then once again when some additional formats were added recently (I believe they were .oxm and .wma). Something like this would be quite nice:

client
AllowUpload(filename,filesize,filetype)
if(filetype == SOUND_FILETYPE && filesize < 256000) return 1
else return 0


As opposed to what I've got currently:
client
AllowUpload(filename,filesize)
var/extension = ""
for(var/i=length(filename);i>0;i--)
if(text2ascii(filename,i) == 46)
extension = ckey(copytext(filename,(i+1)))
break
switch(extension)
if("aiff","it","mid","midi","mod","ogg","oxm","raw","s3m","wav","wma","xm")
if(filesize < 256000) return 1
return 0