שקיפות תמונה ברכיב FW Gallery

פורסם בשישי, 07 אוגוסט 2015 15:27
נכתב על ידי אהוי - Ahoy

fastweb fwgalleryתיקון שקיפות (Transparency) תמונות עבור תוסף גלריה FW Gallery מעל סביבת הפיתוח ג'ומלה (Joomla) - מאפשר טעינת תמונות בשקיפות מלאה והצגתן מעל כל רקע אחורי ו\או הגדרת רקע משתנה באמצעות CSS.

FW Gallry for Joomla fix, abels displaying fully transparent images & thus using CSS customizable or image background.

רכיב FW Gallery הנו תוסף גלריה נוח להתקנה ושימוש ותואם לתצוגת מובייל רספונסיבית (Responsive) ולכן מומלץ לשימוש. אולם ובאופן מפתיע, בעת טעינת תמונה לגלריה היא מקבלת רקע שחור ולא שקוף ואין אפשרות הגדרה אחרת. לכן וכדי לאפשר רקע שקוף לתמונה שיאפשר הצגתה מעל כל רקע אחורי ו\או הגדרת רקע דינאמי באמצעות CSS (למשל DIV#cerabox { background-color: #1D1D1B; }) - יש לבצע דריכת קוד ותיקון בקוד הגרעין של התוסף (שימו לב, בעת עדכון גרסה ידרכו קבצים אלו ויידרש עדכון חוזר של התיקון).

 FW Gallery by FASTWEB is a very flexiable & easy to install and use gallery component & module for Joomla. It is also responsive & thus very recomanded. Alas, when uploading an image it forces a black solid background (CSS code #000000) limiting the UI options of display. Thus, a simple code fix to source files (Not view files, thus keep in mind fix will be overriden durring version update) make the image load with a transparent background, enabling display over other background layers or forcing a CSS background color to your liking (Override DIV#cerabox { background-color: #1D1D1B; } as an example).

התיקון - The Fix

על מנת לבצע את התיקון, יש לגשת ישירות לקבצי הגרעין של הרכיב ולכן חשוב לשמור בצד עותק של קבצי המקור ולוודא כי בשעת עדכון יבוצע התיקון שוב ובהתאם.

To add fix, search on "components/com_fwgallery/helpers/helper.php" & "components/com_fwgallery/models/image.php" for function call "imagecreatetruecolor", replace traget variable as shown in example. Then paste code lines, below orignal source code line detected.

On both files, need to paste two times on current version (Note lines numbering changes between component versions - So please search manually).

פתחו את הקובץ "components/com_fwgallery/helpers/helper.php" ואת הקובץ "components/com_fwgallery/models/image.php" וחפשו את שורות קוד המכילות "imagecreatetruecolor" (שהיא פונקציית יצירת התמונה). זהו את המשתנה אליו מושם הערך המוחזר מהפונקציה ועדכנו אותו בקוד הבא שיודבק מיד אחרי שורת הקוד שאיתרם וכמו בדוגמא:

  1. איתרם את שורת הקוד 138 עם:

    Search source code line

    $buff_image = imagecreatetruecolor($width, $height);

  2. עדכנו את הקוד והדביקו ישירות מתחת:

Replace traget variable & paste directly below line

/* ## AhoyIT: Fix image creation to full transparecny >> */

imagesavealpha($buff_image, true);

$trans_colour = imagecolorallocatealpha($buff_image, 0, 0, 0, 127);

imagefill($buff_image, 0, 0, $trans_colour);

header("Content-type: image/png");

imagepng($buff_image);

/* ## AhoyIT: << Fix image creation to full transparecny */

חשוב לזכור, מספרי השורות יכולים להשתנות בין גרסאות התוסף וחובה לבצע חיפוש ידני מלא.

צריכים סיוע נוסף בהטמעת התיקון או הגלריה, צרו קשר עם AhoyIT בדוא"ל info [AT] ahoyit.com.