I'm looking for a way to auto shrink the images as they are being uploaded to the PWS before they are saved to the database. Some of the images are enormous 3000 + and I would like to shrink them down to 640.
Is there a way to modify the PWS to include an auto shrink feature either in the code of the upload process or in the database stored procedures so as the images are always shrunk to a good web optimized size
I experienced the same issue. Was actually hosting on Go Daddy and filled the DB up. Images are not stored as compressed in the DB @ Go Daddy so it doesn't take many.
I used the PWS kit from Jeremy Wadsworth and modified it to meet my needs. It stores the pictures in directories instead of the DB and only puts a pointer in the DB. Seems to run faster and you don't have the DB issue.
Also, I would recommend using Adobe Elements and do the save for web process. It makes the images smaller and easier to upload as well as less space and you don't sacrifice too much quality.
I agree with Bob that it is recommended that Images be processed and converted to smaller image size regardless of whether you use the file system or database. I think often time people make the mistake of uploading the original image file off the camera
which in most cases is way too large to be putting up on the web. If you're using Photoshop, there is an Image Processor that allows for batch processing of images.
I agree that they need to be compressed or shrunk before uploaded. I'm looking to see if there is a way to compress them as part of the upload process built into the PWS. Presently i'm gathering the files then shrinking them and uploading them. I would like
to be able to give the upload ability to my friends and family but i know they have no idea how to shrink images.
I'm looking for something that I can add to the PWS or make some code changes on the PWS to shrink by a set percentage when my friends or family select files for upload so whatever goes into the database has already been shrunk by the upload page of the
PWS
Got it. Now I don’t need to use Adobe any more. [:)]
While this change will resize the images before they get saved into the database, it will not save you the time waiting for the huge images being uploaded.
In App_Code\PhotoManager.vb go to the Sub AddPhoto and change this line,
Now the image is resized to 600x400 before it's stored into the DB. You don't have to go all the way down to 600x400, you could always keep the @BytesFull at 1024 so the downloaded image a little bigger than
the full image size. So now my new Sub AddPhoto looks like this,
Public Shared Sub AddPhoto(ByVal AlbumID As Integer, ByVal Caption As String, ByVal Google As String, ByVal Lat As String, ByVal Lon As String, ByVal BytesOriginal() As Byte)
Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("Personal").ConnectionString)
Using command As New SqlCommand("AddPhoto", connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add(New SqlParameter("@AlbumID", AlbumID))
command.Parameters.Add(New SqlParameter("@Caption", Caption))
command.Parameters.Add(New SqlParameter("@Google", Google))
command.Parameters.Add(New SqlParameter("@Lon", Lon))
command.Parameters.Add(New SqlParameter("@Lat", Lat))
command.Parameters.Add(New SqlParameter("@BytesOriginal", ResizeImageFile(BytesOriginal, 600)))
command.Parameters.Add(New SqlParameter("@BytesFull", ResizeImageFile(BytesOriginal, 600)))
command.Parameters.Add(New SqlParameter("@BytesPoster", ResizeImageFile(BytesOriginal, 198)))
command.Parameters.Add(New SqlParameter("@BytesThumb", ResizeImageFile(BytesOriginal, 100)))
connection.Open()
command.ExecuteNonQuery()
End Using
End Using
End Sub
scanner001
Member
20 Points
4 Posts
Shrink images as they are uploaded to the PWS
Nov 01, 2006 01:06 AM|LINK
Hi,
I'm looking for a way to auto shrink the images as they are being uploaded to the PWS before they are saved to the database. Some of the images are enormous 3000 + and I would like to shrink them down to 640.
Is there a way to modify the PWS to include an auto shrink feature either in the code of the upload process or in the database stored procedures so as the images are always shrunk to a good web optimized size
Object Expected component .NET 2.0
rhhanson63
Member
354 Points
76 Posts
Re: Shrink images as they are uploaded to the PWS
Nov 01, 2006 04:54 PM|LINK
I experienced the same issue. Was actually hosting on Go Daddy and filled the DB up. Images are not stored as compressed in the DB @ Go Daddy so it doesn't take many.
I used the PWS kit from Jeremy Wadsworth and modified it to meet my needs. It stores the pictures in directories instead of the DB and only puts a pointer in the DB. Seems to run faster and you don't have the DB issue.
Also, I would recommend using Adobe Elements and do the save for web process. It makes the images smaller and easier to upload as well as less space and you don't sacrifice too much quality.
Bob
jwadsworth
Contributor
2378 Points
542 Posts
Re: Shrink images as they are uploaded to the PWS
Nov 01, 2006 10:40 PM|LINK
I agree with Bob that it is recommended that Images be processed and converted to smaller image size regardless of whether you use the file system or database. I think often time people make the mistake of uploading the original image file off the camera which in most cases is way too large to be putting up on the web. If you're using Photoshop, there is an Image Processor that allows for batch processing of images.
Extended Personal Site Starter kit
scanner001
Member
20 Points
4 Posts
Re: Shrink images as they are uploaded to the PWS
Nov 02, 2006 06:16 AM|LINK
Jeremy,
I agree that they need to be compressed or shrunk before uploaded. I'm looking to see if there is a way to compress them as part of the upload process built into the PWS. Presently i'm gathering the files then shrinking them and uploading them. I would like to be able to give the upload ability to my friends and family but i know they have no idea how to shrink images.
I'm looking for something that I can add to the PWS or make some code changes on the PWS to shrink by a set percentage when my friends or family select files for upload so whatever goes into the database has already been shrunk by the upload page of the PWS
HS2k
Member
89 Points
22 Posts
Re: Shrink images as they are uploaded to the PWS
Nov 02, 2006 08:40 PM|LINK
I had a similar issue; mine was the quality of the displayed image in 600x400 when it’s resized at runtime from a larger image.
I ended up using Adobe to bulk resize all images to 600x400 before uploading.
I agree that a resize at runtime is much easier, I will have a go at it this weekend.
Cheers,
Hs2K
http://www.digitalsnaps.info
HS2k
Member
89 Points
22 Posts
Re: Shrink images as they are uploaded to the PWS
Nov 02, 2006 09:23 PM|LINK
Got it. Now I don’t need to use Adobe any more. [:)]
While this change will resize the images before they get saved into the database, it will not save you the time waiting for the huge images being uploaded.
In App_Code\PhotoManager.vb go to the Sub AddPhoto and change this line,
command.Parameters.Add(New SqlParameter("@BytesOriginal", BytesOriginal))
To
command.Parameters.Add(New SqlParameter("@BytesOriginal", ResizeImageFile(BytesOriginal, 600)))
Now the image is resized to 600x400 before it's stored into the DB. You don't have to go all the way down to 600x400, you could always keep the @BytesFull at 1024 so the downloaded image a little bigger than the full image size. So now my new Sub AddPhoto looks like this,
Public Shared Sub AddPhoto(ByVal AlbumID As Integer, ByVal Caption As String, ByVal Google As String, ByVal Lat As String, ByVal Lon As String, ByVal BytesOriginal() As Byte)
Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("Personal").ConnectionString)
Using command As New SqlCommand("AddPhoto", connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add(New SqlParameter("@AlbumID", AlbumID))
command.Parameters.Add(New SqlParameter("@Caption", Caption))
command.Parameters.Add(New SqlParameter("@Google", Google))
command.Parameters.Add(New SqlParameter("@Lon", Lon))
command.Parameters.Add(New SqlParameter("@Lat", Lat))
command.Parameters.Add(New SqlParameter("@BytesOriginal", ResizeImageFile(BytesOriginal, 600)))
command.Parameters.Add(New SqlParameter("@BytesFull", ResizeImageFile(BytesOriginal, 600)))
command.Parameters.Add(New SqlParameter("@BytesPoster", ResizeImageFile(BytesOriginal, 198)))
command.Parameters.Add(New SqlParameter("@BytesThumb", ResizeImageFile(BytesOriginal, 100)))
connection.Open()
command.ExecuteNonQuery()
End Using
End Using
End Sub
Hope that helps,
Hs2K
http://www.digitalsnaps.info
scanner001
Member
20 Points
4 Posts
Re: Shrink images as they are uploaded to the PWS
Nov 04, 2006 12:57 PM|LINK
HS2K,
Great this seems to work fine. Thanks for the help