|
| 1 | +Documentation |
| 2 | +====== |
| 3 | + |
| 4 | +## Examples ## |
| 5 | + |
| 6 | +### Basic image ### |
| 7 | + |
| 8 | +```ruby |
| 9 | +$basicImage = new \Rathouz\TextImage\TextImage('Basic image'); |
| 10 | +$image = $basicImage->generate(); |
| 11 | +echo $image->getHtmlTag(); |
| 12 | +``` |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +### Image with background ### |
| 17 | + |
| 18 | +```ruby |
| 19 | +$backgroundImage = new \Rathouz\TextImage\TextImage('Image with background'); |
| 20 | +$backgroundImage->setBackgroundColor($greyColor); |
| 21 | +$image2 = $backgroundImage->generate(); |
| 22 | +echo $image2->getHtmlTag(); |
| 23 | +``` |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +### Image with background image ### |
| 28 | + |
| 29 | +```ruby |
| 30 | +$backgroundImage = new \Rathouz\TextImage\TextImage('Image with background image'); |
| 31 | +$backgroundImage->setBackgroundImage('/path/to/image.png'); |
| 32 | +$image = $backgroundImage->generate(); |
| 33 | +echo $image->getHtmlTag(); |
| 34 | +``` |
| 35 | + |
| 36 | +### Image with background watermark (image) ### |
| 37 | + |
| 38 | +```ruby |
| 39 | +// Watermark is automatically centered |
| 40 | +$backgroundImage = new \Rathouz\TextImage\TextImage('Image with watermarks'); |
| 41 | +$backgroundImage->setHeight(250); |
| 42 | +$backgroundImage->setWatermarkImage('/path/to/image.png'); |
| 43 | +$image = $backgroundImage->generate(); |
| 44 | +echo $image->getHtmlTag(); |
| 45 | +``` |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +### Image with background watermark (text) ### |
| 50 | + |
| 51 | +```ruby |
| 52 | +// Watermark is automatically centered |
| 53 | +$backgroundImage = new \Rathouz\TextImage\TextImage('Image with watermarks'); |
| 54 | +$backgroundImage->setHeight(250); |
| 55 | +$backgroundImage->setWatermarkText('Hello world'); |
| 56 | +$backgroundImage->setWatermarkTextAngle(45); |
| 57 | +$image = $backgroundImage->generate(); |
| 58 | +echo $image->getHtmlTag(); |
| 59 | +``` |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +### Image with border ### |
| 64 | + |
| 65 | +```ruby |
| 66 | +$borderedImage = new \Rathouz\TextImage\TextImage('Image with border'); |
| 67 | +$borderedImage->setBackgroundColor($greyColor); |
| 68 | +$borderedImage->setBorder(3); |
| 69 | +$borderedImage->setBorderColor($blackColor); |
| 70 | +$image3 = $borderedImage->generate(); |
| 71 | +echo $image3->getHtmlTag(); |
| 72 | +``` |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +### Image with blue text color ### |
| 77 | + |
| 78 | +```ruby |
| 79 | +$coloredImage = new \Rathouz\TextImage\TextImage('Image with blue text color'); |
| 80 | +$coloredImage->setBackgroundColor($greyColor); |
| 81 | +$coloredImage->setTextColor($redColor); |
| 82 | +$image4 = $coloredImage->generate(); |
| 83 | +echo $image4->getHtmlTag(); |
| 84 | +``` |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +### Image with custom padding ### |
| 89 | + |
| 90 | +```ruby |
| 91 | +$paddedImage = new \Rathouz\TextImage\TextImage('Image with custom padding'); |
| 92 | +$paddedImage->setBackgroundColor($greyColor); |
| 93 | +$paddedImage->setPadding(30); |
| 94 | +$image5 = $paddedImage->generate(); |
| 95 | +echo $image5->getHtmlTag(); |
| 96 | +``` |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | +### Image with wrapped text ### |
| 101 | + |
| 102 | +```ruby |
| 103 | +$wrappedImage = new \Rathouz\TextImage\TextImage('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac eros finibus, pretium erat non, fermentum leo. Curabitur hendrerit lobortis risus.'); |
| 104 | +$wrappedImage->setBackgroundColor($greyColor); |
| 105 | +$wrappedImage->setPadding(30); |
| 106 | +$image6 = $wrappedImage->generate(); |
| 107 | +echo $image6->getHtmlTag(); |
| 108 | +``` |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | +### Image with custom line height set ### |
| 113 | + |
| 114 | +```ruby |
| 115 | +$lineImage = new \Rathouz\TextImage\TextImage('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac eros finibus, pretium erat non, fermentum leo. Curabitur hendrerit lobortis risus.'); |
| 116 | +$lineImage->setBackgroundColor($greyColor); |
| 117 | +$lineImage->setPadding(30); |
| 118 | +$lineImage->setLineHeight(40); |
| 119 | +$image7 = $lineImage->generate(); |
| 120 | +echo $image7->getHtmlTag(); |
| 121 | +``` |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | +### Image with stripped text ### |
| 126 | + |
| 127 | +```ruby |
| 128 | +$strippedImage = new \Rathouz\TextImage\TextImage('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac eros finibus, pretium erat non, fermentum leo. Curabitur hendrerit lobortis risus.'); |
| 129 | +$strippedImage->setBackgroundColor($greyColor); |
| 130 | +$strippedImage->setStripText(TRUE); |
| 131 | +$image8 = $strippedImage->generate(); |
| 132 | +echo $image8->getHtmlTag(); |
| 133 | +``` |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | +### Image with custom font ### |
| 138 | + |
| 139 | +```ruby |
| 140 | +$customFontImage = new \Rathouz\TextImage\TextImage('OpenSans-Bold.ttf'); |
| 141 | +$customFontImage->setFontPath(__DIR__ . '/assets/fonts/open-sans/OpenSans-Bold.ttf'); |
| 142 | +$customFontImage->setBackgroundColor($greyColor); |
| 143 | +$image9 = $customFontImage->generate(); |
| 144 | +echo $image9->getHtmlTag(); |
| 145 | +``` |
| 146 | + |
| 147 | + |
0 commit comments