跳至主要内容

博文

save tiff image.

a backup of tiff transform. public function __construct($path,$minSize,$minWidth,$minHeight){ $this->path=$path; $this->minSize=$minSize; $this->minWidth=$minWidth; $this->minHeight=$minHeight; } public function setImage(SmallAdds $ad){ $this->today=date('Y-m-d'); $this->fullImagePath=$this->path.$ad->getSitePath().$this->today."/"; if (!is_dir($this->fullImagePath)){ if (!mkdir($this->fullImagePath,0775, true)) throw new \Exception('can not create folder'); } $this->ad=$ad; $this->name=uniqid(); } public function createPhoto(){ try{ $this->photo=new Photo(); $this->photo->setSmallAdds($this->ad); $imagePath = $this->fullImagePath; $pngName=$imagePath.$this->name.".png"; $tifName=$imagePath.$this-...

mysql regex 来查找 替换 内容

我的例子: UPDATE `t_photos` SET nom_photo= CASE WHEN nom_photo REGEXP '[^_]*.png' THEN CONCAT('old/', REPLACE(nom_photo, '.png','.tif')) END WHERE nom_photo REGEXP '[^_]*.png' 替换前的内容是: 508e652bf1781.png 替换后的内容是: old/508e652bf1781.tif

convert png to piled tif (all files in a folder)

for file in /data/admin/web/data/vivastreet/image/50b7814*; do newname=`basename "$file" png`tif; convert $file -define tiff:tile-geometry=256x256 -compress jpeg "ptif:/mnt/data/vivastreet/$newname"; done well, this will rename the *.png to *.tif and convert them . further more, if you wann only list 100 file in a folder: ls | head -n 100 if you wanna to remove them: ls | head -n 100 | xargs rm

how to set up a squid for apache.

I find a good tutorial and this may be useful lately. http://www.howtoforge.com/how-to-set-up-a-caching-reverse-proxy-with-squid-2.6-on-debian-etch the important is do not cache the login user page, but only cache the anonimouse users page. This is alos ok for spoop.fr.