Category Archives: Development

SVN dump and load

Since a lot of time i use the tortoise svn with visualsvn as my developing repository.

I have it installed locally on the vmware that i use. The repositories are also created locally. At some point i needed a smart way to backup /copy all my repositories from the vmware to the Synology NAS I have sitting at home.  I used to sync all the repos through dropbox but took much time and was not fool proof. I ended up installing the SVN sever on the synology NAS.  After opening the right ports on ly router everything seemed to work ok, but how do you transfer the repo from the local machine to the nas svn???

First i exported the repositories from the local developing machine:

svnadmin dump E:\Wamp\Repositories\tharsitis.gr > E:\Wamp\Repositories\tharsitis.gr.dump

After creating an empty repository in the synology SVN, i copied the previously generated dump file in the synology SVN folder.

synology svn
synology svn

 

 

 

 

 

 

Now the loading…

Login via SSH with root rights on to the SVN and run the following:

where:

svnadmin load  /volume1/SVN/tharsitis.gr < /volume1/SVN/tharsitis.gr.dump --ignore-uuid

where  –ignore-uuid : ignore any repos UUID found in the stream

JPG/PNG Image Optimization

keep-calm-and-start-optimizing[1]In a previous post I refer to image optimization. I started working with image optimization when i got reports from the google webmaster tools that the images used in my web sites are not optimized.

Searching in the internet I ended up working with jpegtran and optipng for the optimization of the images I use in the web. I use the following two batches to automate somehow the whole process. I place the image inside the “Optimize” folder and then according to the file type run the appropriate batch script.

cd "E:\Dropbox\wamp\www\Optimise"
E:
FOR %%G IN (*.jpg) DO (
copy %%G log\%%G
"E:\Dropbox\wamp\www\Optimise\JPGPNGOPT\jpegtran\jpegtran.exe" -optimize %%G %%G
MOVE %%G OPTED\%%G
)
 FOR %%G IN (*.png) DO (
copy %%G log\%%G
"E:\Dropbox\wamp\www\Optimise\JPGPNGOPT\pngout.exe" "E:\Dropbox\wamp\www\Optimise\%%G" "E:\Dropbox\wamp\www\Optimise\%%G" /y
MOVE %%G OPTED\%%G
)

 

PHP Image Resizing…

I have been searching for some time an easy way to change the size of jpg and png images on the fly – on the server. currently my preferred solution is the PHP Image resize script found here ..

The solution is extremely easy to implement. I use it to convert almost 1000 images whos filenames have stored in the database (on the fly).

Have found the following issues though:

  1. All of my images are google optimized (using jpegtran and optipng). After the conversion the new file is 10 times larger in size even though the  dimensions are similar (197×50 and 6kb to 200×50 and 30kb size). So there goes my optimization…
  2. I have manually converted most of my files to width 200 to match my web site layout. When an already 200pixels image passes from the script that sets it to comvert again to 100px,  it sometimes produces a blank png file with, and some times the quality of the image is very bad (even though you set it to convert with the highest quality). I will need to investigate this why the script behaves differently to different png  files if i wanna keep it.
$file="./brands/".$row_Recordset1['NAME']."/logo.png";
$resizedFile="./brands/".$row_Recordset1['NAME']."/".strtolower(str_replace ( ' ', '-', $row_Recordset1['NAME']))."_reslogo.png";

list($width, $height) =getimagesize($file);

echo $width;

//echo $height;

if (file_exists($file)){

 

if (file_exists($resizedFile)){

//to nothing

}else {

smart_resize_image($file , null, 201 , null , true , $resizedFile , false , false ,100 );
}
}else{
$resizedFile="./brands/no-logo-yet.png";
}

Update: Found that issue #2 was caused by the fact that i was scaling the image up, rather than down.  Issue #1 still persists though.

Here is a very informative post about the jpg image optimization and resizing using php native functions