Skip to content

watermanos/Changepathpic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🖼️ HTML Picture Path Updater

A simple C# console application that updates the image paths inside <picture> tags in an HTML file.
Perfect for batch-replacing image URLs when moving content between servers or renaming galleries.


✨ Features

  • ✅ Replace a specific number of <picture> tags
  • ✅ Replace only image paths starting with a specific base path
  • ✅ Automatically renames images using a number format (e.g. 01.jpg, 02.jpg, ...)
  • ✅ Saves the modified HTML file as updated.html in the same folder

🛠️ Usage

  1. Clone or download the project
  2. Build the project in Visual Studio (requires .NET)
  3. Run the compiled .exe or run from terminal/console

🧪 Sample Input

You have this in your HTML:

<picture>
  <source srcset="https://old-domain.com/images/gallery/photo1.jpg" />
  <img src="https://old-domain.com/images/gallery/photo1.jpg" />
</picture>

🚀 When running the app:

Enter the full path to your HTML file: C:\Users\user\Desktop\index.html
How many images to update? 3
Enter the old base path to replace: https://old-domain.com/images/gallery/
Enter the new base path: https://new-domain.com/images/event/

✅ Result (after update)

<picture>
  <source srcset="https://new-domain.com/images/event/01.jpg" />
  <img src="https://new-domain.com/images/event/01.jpg" />
</picture>

📄 Output

The updated HTML will be saved as:

updated.html

in the same folder as the original.


📦 Dependencies

Install via NuGet:

Install-Package HtmlAgilityPack

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages