Можно указать параметр где именно накладывать логотип, доступны все 4 угла, указывать их через параметр coordinate по часовой стрелке, начало отсчета левый верхний угол: 1-верхний, левый, 2-правый, верхний, 3-нижний, правый...
PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?PHP
- class cms_setlogo_img {
- public $coordinate=4; // 1-верхний, левый, 2-правый, верхний, 3-нижний, правый...
- function coordinat($srcWidth, $srcHeight, $logoWidth, $logoHeight){
- if($this->coordinate==1){
- $this->coord[1]=0;
- $this->coord[2]=0;
- } elseif($this->coordinate==2){
- $this->coord[1]=$srcWidth - $logoWidth;
- $this->coord[2]=0;
- } elseif($this->coordinate==3){
- $this->coord[1]=$srcWidth - $logoWidth;
- $this->coord[2]=$srcHeight - $logoHeight;
- } else {
- $this->coord[1]=0;
- $this->coord[2]=$srcHeight - $logoHeight;
- }
- }
- function load($filename) {
- $this->image_type=$image_info[2];
- if($this->image_type == IMAGETYPE_JPEG ) {
- } elseif($this->image_type == IMAGETYPE_GIF ) {
- } elseif($this->image_type == IMAGETYPE_PNG ) {
- }
- }
- function save($img,$srcImage) {
- if($this->image_type == IMAGETYPE_JPEG ) {
- } elseif($this->image_type == IMAGETYPE_GIF ) {
- } elseif($this->image_type == IMAGETYPE_PNG ) {
- }
- }
- function setlogo($img,$logosrc)
- {
- $srcImage = $this->load($img);
- $logoImage = $this->load($logosrc);
- $this->coordinat($srcWidth, $srcHeight, $logoWidth, $logoHeight);
- $this->save($img,$srcImage);
- }
- }