Module: GD
- Defined in:
- ext/gd/gd.c
Defined Under Namespace
Class Method Summary collapse
Class Method Details
.ext_for(sym) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'ext/gd/gd.c', line 44 static VALUE gd_ext_for(VALUE self, VALUE sym) { const char *t = rb_id2name(SYM2ID(sym)); if (!strcmp(t,"png")) return rb_str_new_cstr(".png"); if (!strcmp(t,"jpeg")) return rb_str_new_cstr(".jpg"); if (!strcmp(t,"jpg")) return rb_str_new_cstr(".jpg"); if (!strcmp(t,"gif")) return rb_str_new_cstr(".gif"); if (!strcmp(t,"webp")) return rb_str_new_cstr(".webp"); if (!strcmp(t,"bmp")) return rb_str_new_cstr(".bmp"); return Qnil; } |
.info ⇒ Object
6 7 8 |
# File 'ext/gd/gd.c', line 6 static VALUE gd_info(VALUE self) { return rb_str_new_cstr(gdVersionString()); } |
.mime_for(sym) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'ext/gd/gd.c', line 31 static VALUE gd_mime_for(VALUE self, VALUE sym) { const char *t = rb_id2name(SYM2ID(sym)); if (!strcmp(t,"png")) return rb_str_new_cstr("image/png"); if (!strcmp(t,"jpeg")) return rb_str_new_cstr("image/jpeg"); if (!strcmp(t,"jpg")) return rb_str_new_cstr("image/jpeg"); if (!strcmp(t,"gif")) return rb_str_new_cstr("image/gif"); if (!strcmp(t,"webp")) return rb_str_new_cstr("image/webp"); if (!strcmp(t,"bmp")) return rb_str_new_cstr("image/bmp"); return Qnil; } |
.types ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'ext/gd/gd.c', line 10 static VALUE gd_types(VALUE self) { VALUE h = rb_hash_new(); rb_hash_aset(h, ID2SYM(rb_intern("png")), gdSupportsFileType("test.png", 1) ? Qtrue : Qfalse); rb_hash_aset(h, ID2SYM(rb_intern("jpeg")), gdSupportsFileType("test.jpg", 1) ? Qtrue : Qfalse); rb_hash_aset(h, ID2SYM(rb_intern("gif")), gdSupportsFileType("test.gif", 1) ? Qtrue : Qfalse); rb_hash_aset(h, ID2SYM(rb_intern("webp")), gdSupportsFileType("test.webp", 1) ? Qtrue : Qfalse); rb_hash_aset(h, ID2SYM(rb_intern("bmp")), gdSupportsFileType("test.bmp", 1) ? Qtrue : Qfalse); return h; } |
.version ⇒ Object
3 4 5 |
# File 'ext/gd/version.c', line 3 VALUE rb_gd_version(VALUE self) { return rb_str_new_cstr(gdVersionString()); } |