לוגו אתר Fresh          
 
 
  אפשרות תפריט  ראשי     אפשרות תפריט  צ'אט     אפשרות תפריט  מבזקים     אפשרות תפריט  צור קשר     חץ שמאלה ‎print ‎"Hello World!"; if‎ ‎not rules.‎know ‎then rules.‎read(); חץ ימינה  

לך אחורה   לובי הפורומים > מחשבים > תכנות ובניית אתרים
שמור לעצמך קישור לדף זה באתרי שמירת קישורים חברתיים
תגובה
 
כלי אשכול חפש באשכול זה



  #1  
ישן 29-12-2005, 11:49
  Imial Imial אינו מחובר  
 
חבר מתאריך: 04.07.05
הודעות: 513
משתף אותך בקוד שלי מהאתר שלי loading.co.il בהקטנת תמונות + כתיבה וכו'

מכיוון שפרש זה פורום שלוט החלטתי לפרסם את הקוד
למשל לדוגמא של הקוד http://loading.co.il/h.php?id=66






קוד PHP:
 include_once('conf.php'); // include configuration for mysql

 
$id $_GET['id']; // get archive identity
// check if vaild identity - >>
 
 
 
 
if(!isset($_GET['id'])) die("Please insert file identification - Loading.co.il");
 
if(!
is_numeric($id)) die("Identification must be a number - Loading.co.il");
if(
$id == 0) die("Identification can not be '0' - Loading.co.il");
if(
$id 0) die("Identification can not be a negative number - Loading.co.il");
$req mysql_fetch_array(mysql_query("SELECT file FROM images WHERE id = '$id'")); // select file from db
$FILE $req['file'];
if(!
file_exists($FILE)) die("File does not exists - Loading.co.il");
if(!
is_readable($FILE)) die("File is not readable - Loading.co.il");
 
 
 
 
// << - end check if vaild indentity
 
 
 
$background imagecreatetruecolor(140,140); // creat BG for picture
 
$type null;
if(
preg_match("/.jpg/i"$FILE) || preg_match("/.jpg/i"$FILE)){ // start finding the file type and if not an image die
$insert imagecreatefromjpeg($FILE); // creat a workable image
$type 1;
} elseif(
preg_match("/.png/i"$FILE)){
$insert imagecreatefrompng($FILE);
$type 2;
} elseif(
preg_match("/.gif/i"$FILE)){
$insert imagecreatefromgif($FILE);
$type 3;
} else die(
"Only .jpg .jpeg .gif .png extantions will be accepted");
 
 
 
 
$filesize filesize($FILE); // getting the image size
 
if($filesize 999$filesize ceil($filesize 1000) . "KB"// calculaiting the image size for an out put
else $filesize $filesize "Byte";
$insert_x imagesx($insert); // images x
$insert_y imagesy($insert); // images y
 
 
 
 
imagecopyresampled($background$insert3300134109$insert_x$insert_y); // resize image into BG
 
imagecopymerge($background,imagecreatefromjpeg("x.jpg"),8,116,0,0,10,5,100); // insert arrows to image
imagecopymerge($background,imagecreatefromjpeg("y.jpg"),8,126,0,0,5,10,100); 
$font 'arial.ttf'// font name
ImageTTFText ($background,8,09,17,ImageColorAllocate ($background 000),$font,"Loading.co.il") or die("Could not open/find font arial.ttf"); // out put txt
ImageTTFText ($background,8,08,16,ImageColorAllocate ($background 255255255),$font,"Loading.co.il") or die("Could not open/find font arial.ttf"); 
ImageTTFText ($background,9,020,123,ImageColorAllocate ($background 255255255),$font,$insert_x."px") or die("Could not open/find font arial.ttf"); 
ImageTTFText ($background,9,020,135,ImageColorAllocate ($background 255255255),$font,$insert_y."px") or die("Could not open/find font arial.ttf"); 
ImageTTFText ($background,100,70,130,ImageColorAllocate ($background 255255255),$font,$filesize) or die("Could not open/find font arial.ttf");
 
 
 
 
if(
$type != null && $type == 1imagejpeg($background""100);
 
elseif(
$type != null && $type == 2imagepng($background""100);
elseif(
$type != null && $type == 3imagegif($background""100); 








אם אתם משתמשים בתמונות גדולות תקבלו את הטעות הזאת





קוד:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 6400 bytes) in /*****/public_html/h.php on line 21


לתיקון הכניסו את





קוד PHP:
 ini_set("memory_limit","50M"); 



ברירת המחדל היא 8



אשמח אם למשהו יהיה רעיונות לעזור לי לשפר את הקוד, אגב למה אי אפשר לעבוד עם BMP?

אגב אני לא סובל את הוערך הזה , זה FCK? לא סובל אותו בכלל לא נוח
_____________________________________
Exelent ef-you-see-kaye


נערך לאחרונה ע"י Imial בתאריך 29-12-2005 בשעה 12:00.
תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
  #3  
ישן 29-12-2005, 12:37
  Imial Imial אינו מחובר  
 
חבר מתאריך: 04.07.05
הודעות: 513
בתגובה להודעה מספר 2 שנכתבה על ידי ישראל K שמתחילה ב "אתה מודע לזה שהדף לא עובד כמו..."

בשביל זה אני מתייעץ פה אתה צודק צריך להכניס לזה כותרת[

היניי הקוד המתוקן
קוד PHP:
 include_once('conf.php'); // include configuration for mysql
 
$id $_GET['id']; // get archive identity
 
ini_set("memory_limit","50M"); // give memory limit bigger
 // check if vaild identity - >>[/left]
[left] if(!isset($_GET['id'])) die("Please insert file identification - Loading.co.il");
 if(!
is_numeric($id)) die("Identification must be a number - Loading.co.il");
 if(
$id == 0) die("Identification can not be '0' - Loading.co.il");
 if(
$id 0) die("Identification can not be a negative number - Loading.co.il");
 
$req mysql_fetch_array(mysql_query("SELECT file FROM images WHERE id = '$id'")); // select file from db
 
$FILE $req['file'];
 if(!
file_exists($FILE)) die("File does not exists - Loading.co.il");
 if(!
is_readable($FILE)) die("File is not readable - Loading.co.il");[/left]
[
left// << - end check if vaild indentity[/left]
[left$background imagecreatetruecolor(140,140); // creat BG for picture
 
$type null;
 if(
preg_match("/.jpg/i"$FILE) || preg_match("/.jpg/i"$FILE)){   // start finding the file type and if not an image die
  
header("Content-type: image/jpeg"); // set content type
  
$insert imagecreatefromjpeg($FILE); // creat a workable image
  
$type 1;
 } elseif(
preg_match("/.png/i"$FILE)){
  
header("Content-type: image/png"); // set content type
  
$insert imagecreatefrompng($FILE);
  
$type 2;
 } elseif(
preg_match("/.gif/i"$FILE)){
  
header("Content-type: image/gif"); // set content type
  
$insert imagecreatefromgif($FILE);
  
$type 3;
 } else die(
"Only .jpg .jpeg .gif .png extantions will be accepted");[/left]
[
left$filesize filesize($FILE); // getting the image size
 
if($filesize 999$filesize ceil($filesize 1000) . "KB"// calculaiting the image size for an out put
 
else $filesize $filesize "Byte";
 
$insert_x imagesx($insert); // images x
 
$insert_y imagesy($insert); // images y[/left]
[leftimagecopyresampled($background$insert3300134109$insert_x$insert_y); // resize image into BG
 
imagecopymerge($background,imagecreatefromjpeg("x.jpg"),8,116,0,0,10,5,100); // insert arrows to image
 
imagecopymerge($background,imagecreatefromjpeg("y.jpg"),8,126,0,0,5,10,100); 
 
$font 'arial.ttf'// font name
 
ImageTTFText ($background,8,09,17,ImageColorAllocate ($background 000),$font,"Loading.co.il") or die("Could not open/find font arial.ttf"); // out put txt
 
ImageTTFText ($background,8,08,16,ImageColorAllocate ($background 255255255),$font,"Loading.co.il") or die("Could not open/find font arial.ttf"); 
 
ImageTTFText ($background,9,020,123,ImageColorAllocate ($background 255255255),$font,$insert_x."px") or die("Could not open/find font arial.ttf"); 
 
ImageTTFText ($background,9,020,135,ImageColorAllocate ($background 255255255),$font,$insert_y."px") or die("Could not open/find font arial.ttf"); 
 
ImageTTFText ($background,100,70,130,ImageColorAllocate ($background 255255255),$font,$filesize) or die("Could not open/find font arial.ttf");[/left]
[
left] if($type != null && $type == 1imagejpeg($background""100);
 elseif(
$type != null && $type == 2imagepng($background""100);
 elseif(
$type != null && $type == 3imagegif($background""100); 
_____________________________________
Exelent ef-you-see-kaye


נערך לאחרונה ע"י Imial בתאריך 29-12-2005 בשעה 12:41.
תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
  #7  
ישן 29-12-2005, 14:30
  emanuel emanuel אינו מחובר  
 
חבר מתאריך: 11.02.05
הודעות: 569
שלח הודעה דרך ICQ אל emanuel
כל הכבוד על זה ששיתפה אותנו בקוד!
בתגובה להודעה מספר 1 שנכתבה על ידי Imial שמתחילה ב "משתף אותך בקוד שלי מהאתר שלי loading.co.il בהקטנת תמונות + כתיבה וכו'"

הקוד די מסובח וארוך...כך שאני לא אבדוק את כולו בקשר למה לשפר...
למה עשיתה שני תנאים?


קוד PHP:
 if($id == 0) die("Identification can not be '0' - Loading.co.il");
if(
$id 0) die("Identification can not be a negative number - Loading.co.il"); 



אפשר היה להסתפק בתנאי אחד עם אופרטור קטן או שווה...
דרך אגב לא הבנתי מה אמרת בקשר לbmp... הקוד לא עובד עם תמונות bmp?

דבר שני בקשר לאיך לציג את זה בגודל המקורי?
אתה הרי שלחת כותר של תמונה נכון? אז זאת בעצם תמונה רגילה כמו jpg או bmp....
מה שאתה כן יכול לעשות זה משהוא כזה...


<a href="http://loading.co.il/h.php?id=66&image=full" target="_blank"><img src="<A href="http://loading.co.il/h.php?id=66"></a">http://loading.co.il/h.php?id=66"></a>


ולהציב את זה בעמוד html או php...ולעשות שאם אתה מקבל בget full אז להציג את התמונה...
כמו שהיא יצתה מהמסד...
תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
תגובה

כלי אשכול חפש באשכול זה
חפש באשכול זה:

חיפוש מתקדם
מצבי תצוגה דרג אשכול זה
דרג אשכול זה:

מזער את תיבת המידע אפשרויות משלוח הודעות
אתה לא יכול לפתוח אשכולות חדשים
אתה לא יכול להגיב לאשכולות
אתה לא יכול לצרף קבצים
אתה לא יכול לערוך את ההודעות שלך

קוד vB פעיל
קוד [IMG] פעיל
קוד HTML כבוי
מעבר לפורום



כל הזמנים המוצגים בדף זה הם לפי איזור זמן GMT +2. השעה כעת היא 13:37

הדף נוצר ב 0.17 שניות עם 12 שאילתות

הפורום מבוסס על vBulletin, גירסא 3.0.6
כל הזכויות לתוכנת הפורומים שמורות © 2025 - 2000 לחברת Jelsoft Enterprises.
כל הזכויות שמורות ל Fresh.co.il ©

צור קשר | תקנון האתר