הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

השב
 
כלים לאשכול תצורת הצגה
ישן 19-06-10, 20:27   # 1
Erez | TrustMedia.co.il
עסק רשום [?]
 
מיני פרופיל
תאריך הצטרפות: Jul 2008
הודעות: 1,854

Erez | TrustMedia.co.il לא מחובר  

היפוך תמונה עם GD ורקעים שקופים

אני מנסה להפוך תמונה בצורה אופקית עם GD אבל תמיד כשיש רקע שקוף זה עושה לי בעיות,הנה הפונקציה שאני משתמש בה כדי להפוך את התמונה:
PHP קוד:
function flipHorizontal(&$img) {
$size_x imagesx($img);
$size_y imagesy($img);
$temp imagecreatetruecolor($size_x$size_y);
$x imagecopyresampled($temp$img00, ($size_x-1), 0$size_x$size_y0-$size_x$size_y);
if (
$x) {
$img $temp;
}
else {
die(
"לא ניתן להפוך את התמונה ".$file);
}

והנה הקוד שבעזרתו אני קורא לפונקציה:
PHP קוד:
preg_match('/\.([a-zA-Z]+)$/',$file,$x);
    
$x $x[1];
    if(
$x == 'png'){
        
$myimage imagecreatefrompng($file);
    } elseif(
$x == 'gif'){
        
$myimage imagecreatefromgif($file);
    }  elseif(
$x == 'jpg' || $x == 'jpeg'){
        
$myimage imagecreatefromjpeg($file);
    } else exit;
    if(isset(
$_POST[md5($file)])){
        
flipHorizontal($myimage);
    }
    if(
$x == 'png'){
        
imagepng($myimage,'new'.$file);
    } elseif(
$x == 'gif'){
        
imagegif($myimage,'new'.$file);
    }  elseif(
$x == 'jpg' || $x == 'jpeg'){
        
imagejpeg($myimage,'new'.$file);
    } else exit; 
אני שובר את הראש כבר שעות ולא מצליח,אז אם מישהו יודע איך לסדר את זה(וכן,חיפשתי פתרונות בגוגל וניסית imagesavealpha וכל מיני שיטות ולא עבד לי)
תודה לעוזרים
__________________
  Reply With Quote
ישן 19-06-10, 22:55   # 2
~The_Sultan~
חבר על
 
מיני פרופיל
תאריך הצטרפות: Oct 2008
הודעות: 771

~The_Sultan~ לא מחובר  

מצאתי את זה ב-PHP.NET:
PHP קוד:
Don't forget about imagealphablending() and imagesavealpha() if you're working with [semi]transparent png.

<?php
$file 
'semitransparent.png'// path to png image
$img imagecreatefrompng($file); // open image
imagealphablending($imgtrue); // setting alpha blending on
imagesavealpha($imgtrue); // save alphablending setting (important)
?>
ותעיין אולי בפונקציה הזו: http://www.php.net/manual/en/functio...ransparent.php

בהצלחה
  Reply With Quote
השב

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 20:06.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ