PageRenderTime 78ms CodeModel.GetById 14ms RepoModel.GetById 12ms app.codeStats 0ms

/docs/latex/class_images.tex

https://gitlab.com/karl3/gs_libs
LaTeX | 223 lines | 176 code | 47 blank | 0 comment | 0 complexity | c19741dedc7dd760d24888e975733650 MD5 | raw file
  1. \hypertarget{class_images}{\section{Images Class Reference}
  2. \label{class_images}\index{Images@{Images}}
  3. }
  4. \subsection*{Static Public Member Functions}
  5. \begin{DoxyCompactItemize}
  6. \item
  7. static \hyperlink{class_images_a6acbeecf6d38b6224ca2e69a5014e7ff}{get\-Val\-Msg\-Array} ()
  8. \item
  9. static \hyperlink{class_images_a883566e1257c9f6f7ea797ba2ce0da06}{square\-\_\-crop} (\$src\-\_\-image, \$dest\-\_\-image, \$thumb\-\_\-size=50, \$jpg\-\_\-quality=90)
  10. \item
  11. static \hyperlink{class_images_a69aaeb92ffa755b98a4092eb0a255c72}{thumbnail} (\$input\-File\-Name, \$max\-Size=100)
  12. \item
  13. static \hyperlink{class_images_a187f2de0b924431a2a7b08a4637fbc9a}{image\-To\-File} (\$im, \$file\-Name, \$quality=90)
  14. \item
  15. static \hyperlink{class_images_a9fd2462b057c4b6bbe052a757addad15}{is\-\_\-animated\-\_\-gif} (\$filename)
  16. \item
  17. static \hyperlink{class_images_a6e88b713f61d605fefc5feb3dc00ff88}{clean\-File\-Name} (\$image\-\_\-name)
  18. \item
  19. static \hyperlink{class_images_a9816037394561e5a162c8162168b20d9}{upload\-File} (\$var\-Name, \$tmp\-Path, \$retain\-Orig=true, \$max\-Size=null, \$lg\-Thumb\-Size=null, \$sq\-Thumb\-Size=null)
  20. \end{DoxyCompactItemize}
  21. \subsection{Detailed Description}
  22. Class for handling images using G\-D, primarily via file upload
  23. S\-O\-M\-E U\-S\-A\-G\-E E\-X\-A\-M\-P\-L\-E\-S F\-O\-R T\-H\-E upload\-File M\-E\-T\-H\-O\-D, W\-H\-I\-C\-H I\-S T\-H\-E P\-R\-I\-M\-A\-R\-Y R\-E\-A\-S\-O\-N T\-H\-I\-S C\-L\-A\-S\-S E\-X\-I\-S\-T\-S
  24. // Do Not retain original, create a safe \char`\"{}full\char`\"{} image, a thumbnail, and a smaller thumbnail \$file\-\_\-info = \hyperlink{class_images_a9816037394561e5a162c8162168b20d9}{Images\-::upload\-File}('item\-\_\-pic', \$\-\_\-\-S\-E\-R\-V\-E\-R\mbox{[}'D\-O\-C\-U\-M\-E\-N\-T\-\_\-\-R\-O\-O\-T'\mbox{]} . '/images/bodyparts/', F\-A\-L\-S\-E, \$config\mbox{[}'max\-\_\-bp\-\_\-img'\mbox{]}, \$config\mbox{[}'max\-\_\-bp\-\_\-img\-\_\-lgthumb'\mbox{]}, \$config\mbox{[}'max\-\_\-bp\-\_\-img\-\_\-smthumb'\mbox{]});
  25. // Retain original, create a safe \char`\"{}full\char`\"{} image, a thumbnail, and a smaller thumbnail \$file\-\_\-info = \hyperlink{class_images_a9816037394561e5a162c8162168b20d9}{Images\-::upload\-File}('item\-\_\-pic', \$\-\_\-\-S\-E\-R\-V\-E\-R\mbox{[}'D\-O\-C\-U\-M\-E\-N\-T\-\_\-\-R\-O\-O\-T'\mbox{]} . '/images/bodyparts/', T\-R\-U\-E, \$config\mbox{[}'max\-\_\-bp\-\_\-img'\mbox{]}, \$config\mbox{[}'max\-\_\-bp\-\_\-img\-\_\-lgthumb'\mbox{]}, \$config\mbox{[}'max\-\_\-bp\-\_\-img\-\_\-smthumb'\mbox{]});
  26. // retain the original, no safe \char`\"{}full\char`\"{} image, no thumbnails \$file\-\_\-info = \hyperlink{class_images_a9816037394561e5a162c8162168b20d9}{Images\-::upload\-File}('item\-\_\-pic', \$\-\_\-\-S\-E\-R\-V\-E\-R\mbox{[}'D\-O\-C\-U\-M\-E\-N\-T\-\_\-\-R\-O\-O\-T'\mbox{]} . '/images/bodyparts/', T\-R\-U\-E, N\-U\-L\-L, N\-U\-L\-L, N\-U\-L\-L);
  27. // do not retain the original, create only the safe \char`\"{}full\char`\"{} image \$file\-\_\-info = \hyperlink{class_images_a9816037394561e5a162c8162168b20d9}{Images\-::upload\-File}('item\-\_\-pic', \$\-\_\-\-S\-E\-R\-V\-E\-R\mbox{[}'D\-O\-C\-U\-M\-E\-N\-T\-\_\-\-R\-O\-O\-T'\mbox{]} . '/images/bodyparts/', F\-A\-L\-S\-E, \$config\mbox{[}'max\-\_\-bp\-\_\-img'\mbox{]}, N\-U\-L\-L, N\-U\-L\-L);
  28. // retain the original, no safe \char`\"{}full\char`\"{} image, create a thumbnail and a smaller thumbnail \$file\-\_\-info = \hyperlink{class_images_a9816037394561e5a162c8162168b20d9}{Images\-::upload\-File}('item\-\_\-pic', \$\-\_\-\-S\-E\-R\-V\-E\-R\mbox{[}'D\-O\-C\-U\-M\-E\-N\-T\-\_\-\-R\-O\-O\-T'\mbox{]} . '/images/bodyparts/', T\-R\-U\-E, N\-U\-L\-L, \$config\mbox{[}'max\-\_\-bp\-\_\-img\-\_\-lgthumb'\mbox{]}, \$config\mbox{[}'max\-\_\-bp\-\_\-img\-\_\-smthumb'\mbox{]});
  29. \begin{DoxyRefDesc}{Todo}
  30. \item[\hyperlink{todo__todo000012}{Todo}]figure out how to resize animated gifs, keeping the animation \end{DoxyRefDesc}
  31. \begin{DoxyAuthor}{Author}
  32. Karl Groves \href{mailto:karl@karlgroves.com}{\tt karl@karlgroves.\-com}
  33. \end{DoxyAuthor}
  34. Definition at line 33 of file Images.\-class.\-php.
  35. \subsection{Member Function Documentation}
  36. \hypertarget{class_images_a6e88b713f61d605fefc5feb3dc00ff88}{\index{Images@{Images}!clean\-File\-Name@{clean\-File\-Name}}
  37. \index{clean\-File\-Name@{clean\-File\-Name}!Images@{Images}}
  38. \subsubsection[{clean\-File\-Name}]{\setlength{\rightskip}{0pt plus 5cm}static clean\-File\-Name (
  39. \begin{DoxyParamCaption}
  40. \item[{}]{\$image\-\_\-name}
  41. \end{DoxyParamCaption}
  42. )\hspace{0.3cm}{\ttfamily [static]}}}\label{class_images_a6e88b713f61d605fefc5feb3dc00ff88}
  43. removes anything non alphanumeric from the file name
  44. \begin{DoxyParams}[1]{Parameters}
  45. string & {\em \$image\-\_\-name} & \\
  46. \hline
  47. \end{DoxyParams}
  48. \begin{DoxyReturn}{Returns}
  49. string
  50. \end{DoxyReturn}
  51. Definition at line 281 of file Images.\-class.\-php.
  52. \hypertarget{class_images_a6acbeecf6d38b6224ca2e69a5014e7ff}{\index{Images@{Images}!get\-Val\-Msg\-Array@{get\-Val\-Msg\-Array}}
  53. \index{get\-Val\-Msg\-Array@{get\-Val\-Msg\-Array}!Images@{Images}}
  54. \subsubsection[{get\-Val\-Msg\-Array}]{\setlength{\rightskip}{0pt plus 5cm}static get\-Val\-Msg\-Array (
  55. \begin{DoxyParamCaption}
  56. {}
  57. \end{DoxyParamCaption}
  58. )\hspace{0.3cm}{\ttfamily [static]}}}\label{class_images_a6acbeecf6d38b6224ca2e69a5014e7ff}
  59. \begin{DoxyReturn}{Returns}
  60. array
  61. \end{DoxyReturn}
  62. Definition at line 40 of file Images.\-class.\-php.
  63. \hypertarget{class_images_a187f2de0b924431a2a7b08a4637fbc9a}{\index{Images@{Images}!image\-To\-File@{image\-To\-File}}
  64. \index{image\-To\-File@{image\-To\-File}!Images@{Images}}
  65. \subsubsection[{image\-To\-File}]{\setlength{\rightskip}{0pt plus 5cm}static image\-To\-File (
  66. \begin{DoxyParamCaption}
  67. \item[{}]{\$im, }
  68. \item[{}]{\$file\-Name, }
  69. \item[{}]{\$quality = {\ttfamily 90}}
  70. \end{DoxyParamCaption}
  71. )\hspace{0.3cm}{\ttfamily [static]}}}\label{class_images_a187f2de0b924431a2a7b08a4637fbc9a}
  72. Save the image to a file. Type is determined from the extension. \$quality is only used for jpegs. Author\-: mthorn.\-net
  73. \begin{DoxyParams}[1]{Parameters}
  74. resource & {\em \$im} & resource handler for the new image \\
  75. \hline
  76. string & {\em \$file\-Name} & name for the new image \\
  77. \hline
  78. int & {\em \$quality} & quality of the image, only relevant if jpg/ jpeg\\
  79. \hline
  80. \end{DoxyParams}
  81. \begin{DoxyReturn}{Returns}
  82. bool
  83. \end{DoxyReturn}
  84. Definition at line 209 of file Images.\-class.\-php.
  85. \hypertarget{class_images_a9fd2462b057c4b6bbe052a757addad15}{\index{Images@{Images}!is\-\_\-animated\-\_\-gif@{is\-\_\-animated\-\_\-gif}}
  86. \index{is\-\_\-animated\-\_\-gif@{is\-\_\-animated\-\_\-gif}!Images@{Images}}
  87. \subsubsection[{is\-\_\-animated\-\_\-gif}]{\setlength{\rightskip}{0pt plus 5cm}static is\-\_\-animated\-\_\-gif (
  88. \begin{DoxyParamCaption}
  89. \item[{}]{\$filename}
  90. \end{DoxyParamCaption}
  91. )\hspace{0.3cm}{\ttfamily [static]}}}\label{class_images_a9fd2462b057c4b6bbe052a757addad15}
  92. Thanks to Ze\-Badger for original example, and Davide Gualano for pointing me to it Original at \href{http://it.php.net/manual/en/function.imagecreatefromgif.php#59787}{\tt http\-://it.\-php.\-net/manual/en/function.\-imagecreatefromgif.\-php\#59787}
  93. \begin{DoxyParams}[1]{Parameters}
  94. string & {\em \$filename} & \\
  95. \hline
  96. \end{DoxyParams}
  97. \begin{DoxyReturn}{Returns}
  98. bool
  99. \end{DoxyReturn}
  100. Definition at line 246 of file Images.\-class.\-php.
  101. \hypertarget{class_images_a883566e1257c9f6f7ea797ba2ce0da06}{\index{Images@{Images}!square\-\_\-crop@{square\-\_\-crop}}
  102. \index{square\-\_\-crop@{square\-\_\-crop}!Images@{Images}}
  103. \subsubsection[{square\-\_\-crop}]{\setlength{\rightskip}{0pt plus 5cm}static square\-\_\-crop (
  104. \begin{DoxyParamCaption}
  105. \item[{}]{\$src\-\_\-image, }
  106. \item[{}]{\$dest\-\_\-image, }
  107. \item[{}]{\$thumb\-\_\-size = {\ttfamily 50}, }
  108. \item[{}]{\$jpg\-\_\-quality = {\ttfamily 90}}
  109. \end{DoxyParamCaption}
  110. )\hspace{0.3cm}{\ttfamily [static]}}}\label{class_images_a883566e1257c9f6f7ea797ba2ce0da06}
  111. \begin{DoxyParams}[1]{Parameters}
  112. string & {\em \$src\-\_\-image} & \\
  113. \hline
  114. string & {\em \$dest\-\_\-image} & \\
  115. \hline
  116. int & {\em \$thumb\-\_\-size} & \\
  117. \hline
  118. int & {\em \$jpg\-\_\-quality} & \\
  119. \hline
  120. \end{DoxyParams}
  121. \begin{DoxyReturn}{Returns}
  122. bool
  123. \end{DoxyReturn}
  124. Definition at line 60 of file Images.\-class.\-php.
  125. \hypertarget{class_images_a69aaeb92ffa755b98a4092eb0a255c72}{\index{Images@{Images}!thumbnail@{thumbnail}}
  126. \index{thumbnail@{thumbnail}!Images@{Images}}
  127. \subsubsection[{thumbnail}]{\setlength{\rightskip}{0pt plus 5cm}static thumbnail (
  128. \begin{DoxyParamCaption}
  129. \item[{}]{\$input\-File\-Name, }
  130. \item[{}]{\$max\-Size = {\ttfamily 100}}
  131. \end{DoxyParamCaption}
  132. )\hspace{0.3cm}{\ttfamily [static]}}}\label{class_images_a69aaeb92ffa755b98a4092eb0a255c72}
  133. Create a thumbnail image from \$input\-File\-Name no taller or wider than \$max\-Size. Returns the new image resource or false on error. Author\-: mthorn.\-net
  134. \begin{DoxyParams}[1]{Parameters}
  135. string & {\em \$input\-File\-Name} & \\
  136. \hline
  137. int & {\em \$max\-Size} & \\
  138. \hline
  139. \end{DoxyParams}
  140. \begin{DoxyReturn}{Returns}
  141. string
  142. \end{DoxyReturn}
  143. Definition at line 149 of file Images.\-class.\-php.
  144. \hypertarget{class_images_a9816037394561e5a162c8162168b20d9}{\index{Images@{Images}!upload\-File@{upload\-File}}
  145. \index{upload\-File@{upload\-File}!Images@{Images}}
  146. \subsubsection[{upload\-File}]{\setlength{\rightskip}{0pt plus 5cm}static upload\-File (
  147. \begin{DoxyParamCaption}
  148. \item[{}]{\$var\-Name, }
  149. \item[{}]{\$tmp\-Path, }
  150. \item[{}]{\$retain\-Orig = {\ttfamily true}, }
  151. \item[{}]{\$max\-Size = {\ttfamily null}, }
  152. \item[{}]{\$lg\-Thumb\-Size = {\ttfamily null}, }
  153. \item[{}]{\$sq\-Thumb\-Size = {\ttfamily null}}
  154. \end{DoxyParamCaption}
  155. )\hspace{0.3cm}{\ttfamily [static]}}}\label{class_images_a9816037394561e5a162c8162168b20d9}
  156. \begin{DoxyParams}[1]{Parameters}
  157. string & {\em \$var\-Name} & \\
  158. \hline
  159. string & {\em \$tmp\-Path} & \\
  160. \hline
  161. bool & {\em \$retain\-Orig} & \\
  162. \hline
  163. int & {\em \$max\-Size} & \\
  164. \hline
  165. int & {\em \$lg\-Thumb\-Size} & \\
  166. \hline
  167. int & {\em \$sq\-Thumb\-Size} & \\
  168. \hline
  169. \end{DoxyParams}
  170. \begin{DoxyReturn}{Returns}
  171. string
  172. \end{DoxyReturn}
  173. Definition at line 302 of file Images.\-class.\-php.
  174. The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize}
  175. \item
  176. /\-Users/karlgroves/\-Documents/sites/gs\-\_\-libs/Images.\-class.\-php\end{DoxyCompactItemize}