pillinetwork hesabınızla giriş yapın.

Etiket:

image hakkındaki yazılar:

jQuery ile fotoğraf varmı yokmu?

jQuery ile bir tek veritabanı bağlantısı yapmadığımız kaldı zaten:) Başlıktanda anlayacağınız gibi bu yazıda jQuery ile verdiğiniz fotoğrafın kaynağında fotoğraf varmı yoksa kırıkmı ona bakacağız.

1
2
3
4
5
6
7
8
9
$(document).ready(function() {
$('img.noimage').error(function() {
$(this).attr({
src: 'http://adres.com/fotograf_bulunamadı.gif',
alt: 'Fotoğraf bulunamadı',
style:'border: 1px solid #f00;width:150px;height:60px;'
});
});
});

/* Fornox yazdı. 22 Temmuz 2009 13:47. 6 yorum var */

asp.net Neodynamic ImageDraw ile resim boyutlandırma

bu yazıda size asp.net'teki fileUpload bileşeni ile resim upload ederken Neodynamic ImageDraw ile resmi istediğimiz ordan küçültüp server kısmına kaydetmeyi anlatıcam...

öncelikle Neodynamic ImageDraw bileşenini bilgisayarına indirin ve projenize referans olarak ekleyin...

sonra projemize bir adet fileUpload bileşeni, bir adet button , bilgi amacıyla bir label ve yüklediğimiz resmi göstermesi için bir image ekliyoruz.
sonra buttonun kod kısmı ise şöyle olacak :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
protected void fileUpload_Click(object sender, EventArgs e)
{
if ( fileUpload.HasFile)
{
string dosyaIsmi = karakterIslem(fileUpload.FileName).ToLower();
fileUpload.SaveAs(Server.MapPath("<strong>resmin kaydedeileceği yol</strong>") + dosyaIsmi);
image1.ImageUrl = "../resimler/magaza/" + dosyaIsmi;
label1.Text = dosyaIsmi;
Neodynamic.SDK.ImageElement yuklenenResim;
yüklenenResim = Neodynamic.SDK.ImageElement.FromBinary(fileUpload.FileBytes);
Neodynamic.SDK.Resize actResize = new Neodynamic.SDK.Resize();
actResize.Width = 100;
actResize.LockAspectRatio = Neodynamic.SDK.LockAspectRatio.WidthBased;
yüklenenResim.Actions.Add(actResize);
Neodynamic.SDK.ImageDraw imgDraw = new Neodynamic.SDK.ImageDraw();
imgDraw.Elements.Add(yuklenenResim);
imgDraw.ImageFormat = Neodynamic.SDK.ImageDrawFormat.Jpeg;
imgDraw.JpegCompressionLevel = 90;
string dosyaAdi = Server.MapPath("<strong>resmin kaydedeileceği yol</strong>") + dosyaIsmi;
imgDraw.Save(dosyaAdi);
}
else
{
label1.Text = "Lütfen Resim Seçiniz";
}
}

/* Etiketler: , , , */
/* mmacit yazdı. 30 Haziran 2009 15:51. 8 yorum var */

c# resim format çevirici jpeg, gif, png, bitmap, tiff

Zamanında bir arkadaşım için yazdığım resim çevirme nesnesi. Resmin formatını çevirmekle kalmayıp kalitesini de değiştirebilirsiniz.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
public class Converter
{
public enum enumImageTypes
{
Bitmap,
Jpeg,
Gif,
Tiff,
Png
}
public string ImagePath;
public enumImageTypes ImageType;
public int Quality;
public Converter()
{
this.Quality = 100;
}
public Converter(string inImagePath, enumImageTypes inImageType) : this(inImagePath, inImageType, 100)
{
}
public Converter(string inImagePath, enumImageTypes inImageType, int inQuality)
{
this.ImagePath = inImagePath;
this.ImageType = inImageType;
this.Quality = inQuality;
}
public void Convert()
{
Bitmap bitmap = new Bitmap(ImagePath);
ImageCodecInfo[] imgCodecs = ImageCodecInfo.GetImageEncoders();
EncoderParameters imgParams = new EncoderParameters(1);
EncoderParameter imgQuality = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, Quality);
string imgExt;
imgParams.Param[0] = imgQuality;
imgExt = imgCodecs[(int)ImageType].FilenameExtension;
imgExt = imgExt.Substring(1, imgExt.Length - 1);
string fullpath = ImagePath.Substring(0, ImagePath.Length - 4) + imgExt.Split(';')[0].ToLower().Replace('ı', 'i');
bitmap.Save(fullpath, imgCodecs[(int)ImageType], imgParams);
bitmap.Dispose();
}
public string imagePath
{
get { return this.ImagePath; }
set { this.ImagePath = value; }
}
public enumImageTypes imageType
{
get { return this.ImageType; }
set { this.ImageType = value; }
}
public int quality
{
get { return this.Quality; }
set { this.Quality = value; }
}
}

/* skid yazdı. 17 Nisan 2009 11:02. 2 yorum var */

etiket menüsü

Bu site

Nokta ve pilli ortak yapımı olan kodaman.org hep birlikte içerik üretip gelirini yazarları ile paylaştığımız kolektif bir kod yazarları blogudur. Siz de katılabilirsiniz.

pilliilan

son yorumlar

arama

pillinetwork