Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

php imagecreatefromjpeg() in article

  • tgribble
  • tgribble
  • OFFLINE
  • Posts: 71
  • Thanks: 0
  • Karma: 1
11 years 8 months ago #220629 by tgribble
Replied by tgribble on topic php imagecreatefromjpeg() in article
ok . i got this to work finally:
Code:
<? // VARIABLES $user =& JFactory::getUser(); //gets user object $path = "images/"; $fontpath = "images/fonts/"; $card = imagecreatefromjpeg($path.'membershipcard.jpeg'); // FONT $swiss = $fontpath."swiss.ttf"; $walkway = $fontpath."walkway.ttf"; $copper = $fontpath."Copper Penny DTP.ttf"; $font_lrg = 15; $font_med = 9; $font_sml = 6; // FONT COLOUR $black = imagecolorallocate($card, 0, 0, 0); $red = imagecolorallocate($card, 255, 0, 0); $green = imagecolorallocate($card, 0, 255, 0); // BACKGROUND imagettftext($card, $font_lrg, 0, 10, 25, $red, $swiss, "MEMBERSHIP CARD"); imagettftext($card, $font_med, 0, 10, 40, $black, $swiss, "Name: "); // JOOMLA INFO imagettftext($card, $font_med, 0, 50, 40, $black, $swiss, $user->name); /* EXTRA LINES ( Copy if needed ) imagettftext($card, $font_med, 0, 10, 25, $black, $swiss, "Words go here"); */ // CREATE THE IMAGE $filenametemp="tmp/gif".time().".gif"; ImageGIF($card, $filenametemp); $ImageData = file_get_contents($filenametemp); $ImageDataEnc = base64_encode($ImageData); unlink($filenametemp); // delete the file ?> YOUR MEMBERSHIP CARD</p> <img src="data:image/gif;base64,<?=$ImageDataEnc?>" >

Now i just need to get the data off the database #__comprofiler table to be able to add differnt fields to the card for printing.

where can i get the coding to
1. access the _comprofiler table by the current user
2. get all field of the current user
3. put them into the image in the same way as the $user->name is put in?

thanks


Attachments:

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48457
  • Thanks: 8280
  • Karma: 1443
11 years 8 months ago #220689 by krileon
Replied by krileon on topic php imagecreatefromjpeg() in article
Please see my reply URL below on page 2 where I explain how to use CB API to get a CB $user object. This will allow you to use CB user data directly or use getFields API for example to call for a field.

www.joomlapolis.com/forum/153-professional-member-support/219347-php-imagecreatefromjpeg-in-article?start=6#220024


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum