@adstage/web-sdk 2.2.1 โ†’ 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -392,18 +392,23 @@ class BaseAdRenderer {
392
392
  getImageStyles(slot) {
393
393
  const styles = {
394
394
  display: 'block',
395
- 'max-width': '100%',
396
- height: 'auto',
397
395
  'object-position': 'center', // ๐ŸŽฏ ์ด๋ฏธ์ง€ ํ•ญ์ƒ ์ค‘์•™ ์ •๋ ฌ
398
396
  };
399
- // ์‚ฌ์šฉ์ž๊ฐ€ ์ปจํ…Œ์ด๋„ˆ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ์—๋งŒ ํฌ๊ธฐ ์ œํ•œ
397
+ // ์‚ฌ์šฉ์ž๊ฐ€ ์ปจํ…Œ์ด๋„ˆ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ–ˆ๋Š”์ง€ ํ™•์ธ
400
398
  const parsedWidth = this.parseSizeValue(slot?.width);
401
399
  const parsedHeight = this.parseSizeValue(slot?.height);
402
- if (parsedWidth && parsedHeight) {
400
+ const hasUserDefinedSize = parsedWidth || parsedHeight;
401
+ if (hasUserDefinedSize) {
402
+ // ๐ŸŽฏ ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ: ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐจ๋„๋ก ์„ค์ •
403
403
  styles.width = '100%';
404
404
  styles.height = '100%';
405
- styles['object-fit'] = 'cover';
406
- styles['object-position'] = 'center'; // ๐ŸŽฏ ํฌ๊ธฐ ์กฐ์ • ์‹œ์—๋„ ์ค‘์•™ ์ •๋ ฌ
405
+ styles['object-fit'] = 'cover'; // ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐฌ ์ƒํƒœ๋กœ ๋น„์œจ ์œ ์ง€
406
+ styles['object-position'] = 'center';
407
+ }
408
+ else {
409
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ: ์›๋ณธ ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์œ ์ง€
410
+ styles['max-width'] = '100%';
411
+ styles.height = 'auto';
407
412
  }
408
413
  return styles;
409
414
  }
@@ -2886,23 +2891,45 @@ class AdsModule {
2886
2891
  */
2887
2892
  async renderOptimizedBannerImage(adElement, ad, slot) {
2888
2893
  try {
2889
- // ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์ •๋ณด ๋กœ๋“œ
2890
- const imageDimensions = await this.loadImageDimensions(ad.imageUrl);
2891
- const imageAspectRatio = imageDimensions.width / imageDimensions.height;
2892
- // ์ปจํ…Œ์ด๋„ˆ ๋น„์œจ ๊ณ„์‚ฐ
2893
- const containerAspectRatio = slot.aspectRatio || 16 / 9;
2894
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ–ˆ๋Š”์ง€ ํ™•์ธ
2895
+ const configWidth = slot.config?.width;
2896
+ const configHeight = slot.config?.height;
2897
+ const hasUserDefinedWidth = configWidth &&
2898
+ (typeof configWidth === 'number' || (typeof configWidth === 'string' && configWidth !== '100%'));
2899
+ const hasUserDefinedHeight = configHeight &&
2900
+ (typeof configHeight === 'number' || (typeof configHeight === 'string' && configHeight !== 'auto'));
2901
+ const hasUserDefinedSize = hasUserDefinedWidth || hasUserDefinedHeight;
2894
2902
  // ์ด๋ฏธ์ง€ ์š”์†Œ ์ƒ์„ฑ
2895
2903
  const img = document.createElement('img');
2896
2904
  img.src = ad.imageUrl;
2897
2905
  img.alt = ad.title;
2898
- img.style.width = '100%';
2899
- img.style.height = '100%';
2900
- // ๐ŸŽจ ์ตœ์ ํ™”๋œ ์Šคํƒ€์ผ ์ ์šฉ
2901
- this.applyOptimizedImageStyle(img, imageAspectRatio, containerAspectRatio);
2906
+ if (hasUserDefinedSize) {
2907
+ // ๐ŸŽฏ ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ: ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐจ๋„๋ก ์„ค์ •
2908
+ img.style.width = '100%';
2909
+ img.style.height = '100%';
2910
+ img.style.objectFit = 'cover'; // ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐฌ ์ƒํƒœ๋กœ ๋น„์œจ ์œ ์ง€
2911
+ img.style.objectPosition = 'center';
2912
+ if (this._config?.debug) {
2913
+ console.log(`๐ŸŽฏ User-defined size detected: filling container completely`);
2914
+ }
2915
+ }
2916
+ else {
2917
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ: ๋™์  ์ตœ์ ํ™” ์ ์šฉ
2918
+ const imageDimensions = await this.loadImageDimensions(ad.imageUrl);
2919
+ const imageAspectRatio = imageDimensions.width / imageDimensions.height;
2920
+ const containerAspectRatio = slot.aspectRatio || 16 / 9;
2921
+ img.style.width = '100%';
2922
+ img.style.height = '100%';
2923
+ // ๐ŸŽจ ์ตœ์ ํ™”๋œ ์Šคํƒ€์ผ ์ ์šฉ
2924
+ this.applyOptimizedImageStyle(img, imageAspectRatio, containerAspectRatio);
2925
+ if (this._config?.debug) {
2926
+ console.log(`๐Ÿ–ผ๏ธ Optimized banner image loaded: ${imageDimensions.width}x${imageDimensions.height} (ratio: ${imageAspectRatio.toFixed(2)})`);
2927
+ }
2928
+ }
2902
2929
  // ์ด๋ฏธ์ง€ ๋กœ๋“œ ์™„๋ฃŒ ์ฒ˜๋ฆฌ
2903
2930
  img.onload = () => {
2904
2931
  if (this._config?.debug) {
2905
- console.log(`๐Ÿ–ผ๏ธ Optimized banner image loaded: ${imageDimensions.width}x${imageDimensions.height} (ratio: ${imageAspectRatio.toFixed(2)})`);
2932
+ console.log(`โœ… Banner image loaded successfully`);
2906
2933
  }
2907
2934
  };
2908
2935
  // ์—๋Ÿฌ ์ฒ˜๋ฆฌ
package/dist/index.esm.js CHANGED
@@ -390,18 +390,23 @@ class BaseAdRenderer {
390
390
  getImageStyles(slot) {
391
391
  const styles = {
392
392
  display: 'block',
393
- 'max-width': '100%',
394
- height: 'auto',
395
393
  'object-position': 'center', // ๐ŸŽฏ ์ด๋ฏธ์ง€ ํ•ญ์ƒ ์ค‘์•™ ์ •๋ ฌ
396
394
  };
397
- // ์‚ฌ์šฉ์ž๊ฐ€ ์ปจํ…Œ์ด๋„ˆ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ์—๋งŒ ํฌ๊ธฐ ์ œํ•œ
395
+ // ์‚ฌ์šฉ์ž๊ฐ€ ์ปจํ…Œ์ด๋„ˆ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ–ˆ๋Š”์ง€ ํ™•์ธ
398
396
  const parsedWidth = this.parseSizeValue(slot?.width);
399
397
  const parsedHeight = this.parseSizeValue(slot?.height);
400
- if (parsedWidth && parsedHeight) {
398
+ const hasUserDefinedSize = parsedWidth || parsedHeight;
399
+ if (hasUserDefinedSize) {
400
+ // ๐ŸŽฏ ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ: ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐจ๋„๋ก ์„ค์ •
401
401
  styles.width = '100%';
402
402
  styles.height = '100%';
403
- styles['object-fit'] = 'cover';
404
- styles['object-position'] = 'center'; // ๐ŸŽฏ ํฌ๊ธฐ ์กฐ์ • ์‹œ์—๋„ ์ค‘์•™ ์ •๋ ฌ
403
+ styles['object-fit'] = 'cover'; // ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐฌ ์ƒํƒœ๋กœ ๋น„์œจ ์œ ์ง€
404
+ styles['object-position'] = 'center';
405
+ }
406
+ else {
407
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ: ์›๋ณธ ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์œ ์ง€
408
+ styles['max-width'] = '100%';
409
+ styles.height = 'auto';
405
410
  }
406
411
  return styles;
407
412
  }
@@ -2884,23 +2889,45 @@ class AdsModule {
2884
2889
  */
2885
2890
  async renderOptimizedBannerImage(adElement, ad, slot) {
2886
2891
  try {
2887
- // ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์ •๋ณด ๋กœ๋“œ
2888
- const imageDimensions = await this.loadImageDimensions(ad.imageUrl);
2889
- const imageAspectRatio = imageDimensions.width / imageDimensions.height;
2890
- // ์ปจํ…Œ์ด๋„ˆ ๋น„์œจ ๊ณ„์‚ฐ
2891
- const containerAspectRatio = slot.aspectRatio || 16 / 9;
2892
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ–ˆ๋Š”์ง€ ํ™•์ธ
2893
+ const configWidth = slot.config?.width;
2894
+ const configHeight = slot.config?.height;
2895
+ const hasUserDefinedWidth = configWidth &&
2896
+ (typeof configWidth === 'number' || (typeof configWidth === 'string' && configWidth !== '100%'));
2897
+ const hasUserDefinedHeight = configHeight &&
2898
+ (typeof configHeight === 'number' || (typeof configHeight === 'string' && configHeight !== 'auto'));
2899
+ const hasUserDefinedSize = hasUserDefinedWidth || hasUserDefinedHeight;
2892
2900
  // ์ด๋ฏธ์ง€ ์š”์†Œ ์ƒ์„ฑ
2893
2901
  const img = document.createElement('img');
2894
2902
  img.src = ad.imageUrl;
2895
2903
  img.alt = ad.title;
2896
- img.style.width = '100%';
2897
- img.style.height = '100%';
2898
- // ๐ŸŽจ ์ตœ์ ํ™”๋œ ์Šคํƒ€์ผ ์ ์šฉ
2899
- this.applyOptimizedImageStyle(img, imageAspectRatio, containerAspectRatio);
2904
+ if (hasUserDefinedSize) {
2905
+ // ๐ŸŽฏ ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ: ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐจ๋„๋ก ์„ค์ •
2906
+ img.style.width = '100%';
2907
+ img.style.height = '100%';
2908
+ img.style.objectFit = 'cover'; // ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐฌ ์ƒํƒœ๋กœ ๋น„์œจ ์œ ์ง€
2909
+ img.style.objectPosition = 'center';
2910
+ if (this._config?.debug) {
2911
+ console.log(`๐ŸŽฏ User-defined size detected: filling container completely`);
2912
+ }
2913
+ }
2914
+ else {
2915
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ: ๋™์  ์ตœ์ ํ™” ์ ์šฉ
2916
+ const imageDimensions = await this.loadImageDimensions(ad.imageUrl);
2917
+ const imageAspectRatio = imageDimensions.width / imageDimensions.height;
2918
+ const containerAspectRatio = slot.aspectRatio || 16 / 9;
2919
+ img.style.width = '100%';
2920
+ img.style.height = '100%';
2921
+ // ๐ŸŽจ ์ตœ์ ํ™”๋œ ์Šคํƒ€์ผ ์ ์šฉ
2922
+ this.applyOptimizedImageStyle(img, imageAspectRatio, containerAspectRatio);
2923
+ if (this._config?.debug) {
2924
+ console.log(`๐Ÿ–ผ๏ธ Optimized banner image loaded: ${imageDimensions.width}x${imageDimensions.height} (ratio: ${imageAspectRatio.toFixed(2)})`);
2925
+ }
2926
+ }
2900
2927
  // ์ด๋ฏธ์ง€ ๋กœ๋“œ ์™„๋ฃŒ ์ฒ˜๋ฆฌ
2901
2928
  img.onload = () => {
2902
2929
  if (this._config?.debug) {
2903
- console.log(`๐Ÿ–ผ๏ธ Optimized banner image loaded: ${imageDimensions.width}x${imageDimensions.height} (ratio: ${imageAspectRatio.toFixed(2)})`);
2930
+ console.log(`โœ… Banner image loaded successfully`);
2904
2931
  }
2905
2932
  };
2906
2933
  // ์—๋Ÿฌ ์ฒ˜๋ฆฌ
@@ -390,18 +390,23 @@ class BaseAdRenderer {
390
390
  getImageStyles(slot) {
391
391
  const styles = {
392
392
  display: 'block',
393
- 'max-width': '100%',
394
- height: 'auto',
395
393
  'object-position': 'center', // ๐ŸŽฏ ์ด๋ฏธ์ง€ ํ•ญ์ƒ ์ค‘์•™ ์ •๋ ฌ
396
394
  };
397
- // ์‚ฌ์šฉ์ž๊ฐ€ ์ปจํ…Œ์ด๋„ˆ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ์—๋งŒ ํฌ๊ธฐ ์ œํ•œ
395
+ // ์‚ฌ์šฉ์ž๊ฐ€ ์ปจํ…Œ์ด๋„ˆ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ–ˆ๋Š”์ง€ ํ™•์ธ
398
396
  const parsedWidth = this.parseSizeValue(slot?.width);
399
397
  const parsedHeight = this.parseSizeValue(slot?.height);
400
- if (parsedWidth && parsedHeight) {
398
+ const hasUserDefinedSize = parsedWidth || parsedHeight;
399
+ if (hasUserDefinedSize) {
400
+ // ๐ŸŽฏ ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ: ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐจ๋„๋ก ์„ค์ •
401
401
  styles.width = '100%';
402
402
  styles.height = '100%';
403
- styles['object-fit'] = 'cover';
404
- styles['object-position'] = 'center'; // ๐ŸŽฏ ํฌ๊ธฐ ์กฐ์ • ์‹œ์—๋„ ์ค‘์•™ ์ •๋ ฌ
403
+ styles['object-fit'] = 'cover'; // ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐฌ ์ƒํƒœ๋กœ ๋น„์œจ ์œ ์ง€
404
+ styles['object-position'] = 'center';
405
+ }
406
+ else {
407
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ: ์›๋ณธ ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์œ ์ง€
408
+ styles['max-width'] = '100%';
409
+ styles.height = 'auto';
405
410
  }
406
411
  return styles;
407
412
  }
@@ -2884,23 +2889,45 @@ class AdsModule {
2884
2889
  */
2885
2890
  async renderOptimizedBannerImage(adElement, ad, slot) {
2886
2891
  try {
2887
- // ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์ •๋ณด ๋กœ๋“œ
2888
- const imageDimensions = await this.loadImageDimensions(ad.imageUrl);
2889
- const imageAspectRatio = imageDimensions.width / imageDimensions.height;
2890
- // ์ปจํ…Œ์ด๋„ˆ ๋น„์œจ ๊ณ„์‚ฐ
2891
- const containerAspectRatio = slot.aspectRatio || 16 / 9;
2892
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ–ˆ๋Š”์ง€ ํ™•์ธ
2893
+ const configWidth = slot.config?.width;
2894
+ const configHeight = slot.config?.height;
2895
+ const hasUserDefinedWidth = configWidth &&
2896
+ (typeof configWidth === 'number' || (typeof configWidth === 'string' && configWidth !== '100%'));
2897
+ const hasUserDefinedHeight = configHeight &&
2898
+ (typeof configHeight === 'number' || (typeof configHeight === 'string' && configHeight !== 'auto'));
2899
+ const hasUserDefinedSize = hasUserDefinedWidth || hasUserDefinedHeight;
2892
2900
  // ์ด๋ฏธ์ง€ ์š”์†Œ ์ƒ์„ฑ
2893
2901
  const img = document.createElement('img');
2894
2902
  img.src = ad.imageUrl;
2895
2903
  img.alt = ad.title;
2896
- img.style.width = '100%';
2897
- img.style.height = '100%';
2898
- // ๐ŸŽจ ์ตœ์ ํ™”๋œ ์Šคํƒ€์ผ ์ ์šฉ
2899
- this.applyOptimizedImageStyle(img, imageAspectRatio, containerAspectRatio);
2904
+ if (hasUserDefinedSize) {
2905
+ // ๐ŸŽฏ ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ: ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐจ๋„๋ก ์„ค์ •
2906
+ img.style.width = '100%';
2907
+ img.style.height = '100%';
2908
+ img.style.objectFit = 'cover'; // ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐฌ ์ƒํƒœ๋กœ ๋น„์œจ ์œ ์ง€
2909
+ img.style.objectPosition = 'center';
2910
+ if (this._config?.debug) {
2911
+ console.log(`๐ŸŽฏ User-defined size detected: filling container completely`);
2912
+ }
2913
+ }
2914
+ else {
2915
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ: ๋™์  ์ตœ์ ํ™” ์ ์šฉ
2916
+ const imageDimensions = await this.loadImageDimensions(ad.imageUrl);
2917
+ const imageAspectRatio = imageDimensions.width / imageDimensions.height;
2918
+ const containerAspectRatio = slot.aspectRatio || 16 / 9;
2919
+ img.style.width = '100%';
2920
+ img.style.height = '100%';
2921
+ // ๐ŸŽจ ์ตœ์ ํ™”๋œ ์Šคํƒ€์ผ ์ ์šฉ
2922
+ this.applyOptimizedImageStyle(img, imageAspectRatio, containerAspectRatio);
2923
+ if (this._config?.debug) {
2924
+ console.log(`๐Ÿ–ผ๏ธ Optimized banner image loaded: ${imageDimensions.width}x${imageDimensions.height} (ratio: ${imageAspectRatio.toFixed(2)})`);
2925
+ }
2926
+ }
2900
2927
  // ์ด๋ฏธ์ง€ ๋กœ๋“œ ์™„๋ฃŒ ์ฒ˜๋ฆฌ
2901
2928
  img.onload = () => {
2902
2929
  if (this._config?.debug) {
2903
- console.log(`๐Ÿ–ผ๏ธ Optimized banner image loaded: ${imageDimensions.width}x${imageDimensions.height} (ratio: ${imageAspectRatio.toFixed(2)})`);
2930
+ console.log(`โœ… Banner image loaded successfully`);
2904
2931
  }
2905
2932
  };
2906
2933
  // ์—๋Ÿฌ ์ฒ˜๋ฆฌ
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adstage/web-sdk",
3
- "version": "2.2.1",
4
- "description": "AdStage Web SDK - Production-ready marketing platform SDK with auto-initialization, dynamic sizing, and centered image positioning",
3
+ "version": "2.2.2",
4
+ "description": "AdStage Web SDK - Production-ready marketing platform SDK with auto-initialization, dynamic sizing, centered image positioning, and user-defined size support",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.esm.js",
@@ -1076,27 +1076,52 @@ export class AdsModule implements BaseModule {
1076
1076
  */
1077
1077
  private async renderOptimizedBannerImage(adElement: HTMLElement, ad: Advertisement, slot: AdSlot): Promise<void> {
1078
1078
  try {
1079
- // ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์ •๋ณด ๋กœ๋“œ
1080
- const imageDimensions = await this.loadImageDimensions(ad.imageUrl!);
1081
- const imageAspectRatio = imageDimensions.width / imageDimensions.height;
1079
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ–ˆ๋Š”์ง€ ํ™•์ธ
1080
+ const configWidth = slot.config?.width;
1081
+ const configHeight = slot.config?.height;
1082
1082
 
1083
- // ์ปจํ…Œ์ด๋„ˆ ๋น„์œจ ๊ณ„์‚ฐ
1084
- const containerAspectRatio = (slot as any).aspectRatio || 16/9;
1083
+ const hasUserDefinedWidth = configWidth &&
1084
+ (typeof configWidth === 'number' || (typeof configWidth === 'string' && configWidth !== '100%'));
1085
+ const hasUserDefinedHeight = configHeight &&
1086
+ (typeof configHeight === 'number' || (typeof configHeight === 'string' && configHeight !== 'auto'));
1087
+ const hasUserDefinedSize = hasUserDefinedWidth || hasUserDefinedHeight;
1085
1088
 
1086
1089
  // ์ด๋ฏธ์ง€ ์š”์†Œ ์ƒ์„ฑ
1087
1090
  const img = document.createElement('img');
1088
1091
  img.src = ad.imageUrl!;
1089
1092
  img.alt = ad.title;
1090
- img.style.width = '100%';
1091
- img.style.height = '100%';
1092
1093
 
1093
- // ๐ŸŽจ ์ตœ์ ํ™”๋œ ์Šคํƒ€์ผ ์ ์šฉ
1094
- this.applyOptimizedImageStyle(img, imageAspectRatio, containerAspectRatio);
1094
+ if (hasUserDefinedSize) {
1095
+ // ๐ŸŽฏ ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ: ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐจ๋„๋ก ์„ค์ •
1096
+ img.style.width = '100%';
1097
+ img.style.height = '100%';
1098
+ img.style.objectFit = 'cover'; // ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐฌ ์ƒํƒœ๋กœ ๋น„์œจ ์œ ์ง€
1099
+ img.style.objectPosition = 'center';
1100
+
1101
+ if (this._config?.debug) {
1102
+ console.log(`๐ŸŽฏ User-defined size detected: filling container completely`);
1103
+ }
1104
+ } else {
1105
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ: ๋™์  ์ตœ์ ํ™” ์ ์šฉ
1106
+ const imageDimensions = await this.loadImageDimensions(ad.imageUrl!);
1107
+ const imageAspectRatio = imageDimensions.width / imageDimensions.height;
1108
+ const containerAspectRatio = (slot as any).aspectRatio || 16/9;
1109
+
1110
+ img.style.width = '100%';
1111
+ img.style.height = '100%';
1112
+
1113
+ // ๐ŸŽจ ์ตœ์ ํ™”๋œ ์Šคํƒ€์ผ ์ ์šฉ
1114
+ this.applyOptimizedImageStyle(img, imageAspectRatio, containerAspectRatio);
1115
+
1116
+ if (this._config?.debug) {
1117
+ console.log(`๐Ÿ–ผ๏ธ Optimized banner image loaded: ${imageDimensions.width}x${imageDimensions.height} (ratio: ${imageAspectRatio.toFixed(2)})`);
1118
+ }
1119
+ }
1095
1120
 
1096
1121
  // ์ด๋ฏธ์ง€ ๋กœ๋“œ ์™„๋ฃŒ ์ฒ˜๋ฆฌ
1097
1122
  img.onload = () => {
1098
1123
  if (this._config?.debug) {
1099
- console.log(`๐Ÿ–ผ๏ธ Optimized banner image loaded: ${imageDimensions.width}x${imageDimensions.height} (ratio: ${imageAspectRatio.toFixed(2)})`);
1124
+ console.log(`โœ… Banner image loaded successfully`);
1100
1125
  }
1101
1126
  };
1102
1127
 
@@ -108,20 +108,24 @@ export abstract class BaseAdRenderer implements AdRenderer {
108
108
  protected getImageStyles(slot?: AdSlot): Record<string, string> {
109
109
  const styles: Record<string, string> = {
110
110
  display: 'block',
111
- 'max-width': '100%',
112
- height: 'auto',
113
111
  'object-position': 'center', // ๐ŸŽฏ ์ด๋ฏธ์ง€ ํ•ญ์ƒ ์ค‘์•™ ์ •๋ ฌ
114
112
  };
115
113
 
116
- // ์‚ฌ์šฉ์ž๊ฐ€ ์ปจํ…Œ์ด๋„ˆ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ์—๋งŒ ํฌ๊ธฐ ์ œํ•œ
114
+ // ์‚ฌ์šฉ์ž๊ฐ€ ์ปจํ…Œ์ด๋„ˆ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ–ˆ๋Š”์ง€ ํ™•์ธ
117
115
  const parsedWidth = this.parseSizeValue(slot?.width);
118
116
  const parsedHeight = this.parseSizeValue(slot?.height);
117
+ const hasUserDefinedSize = parsedWidth || parsedHeight;
119
118
 
120
- if (parsedWidth && parsedHeight) {
119
+ if (hasUserDefinedSize) {
120
+ // ๐ŸŽฏ ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•œ ๊ฒฝ์šฐ: ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐจ๋„๋ก ์„ค์ •
121
121
  styles.width = '100%';
122
122
  styles.height = '100%';
123
- styles['object-fit'] = 'cover';
124
- styles['object-position'] = 'center'; // ๐ŸŽฏ ํฌ๊ธฐ ์กฐ์ • ์‹œ์—๋„ ์ค‘์•™ ์ •๋ ฌ
123
+ styles['object-fit'] = 'cover'; // ์ปจํ…Œ์ด๋„ˆ์— ๊ฝ‰ ์ฐฌ ์ƒํƒœ๋กœ ๋น„์œจ ์œ ์ง€
124
+ styles['object-position'] = 'center';
125
+ } else {
126
+ // ์‚ฌ์šฉ์ž๊ฐ€ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ: ์›๋ณธ ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์œ ์ง€
127
+ styles['max-width'] = '100%';
128
+ styles.height = 'auto';
125
129
  }
126
130
 
127
131
  return styles;